Remove __abs__ from bytes and sectors, one should convert to int instead

This commit is contained in:
Anders Ingemann 2015-01-02 15:12:48 +01:00
parent 7f84e405f0
commit b537f2d987
4 changed files with 4 additions and 10 deletions

View file

@ -72,9 +72,6 @@ class Bytes(object):
def __long__(self):
return self.qty
def __abs__(self):
return self.qty
@onlybytes('Can only compare Bytes to Bytes')
def __lt__(self, other):
return self.qty < other.qty

View file

@ -43,9 +43,6 @@ class Sectors(object):
def __long__(self):
return self.get_sectors()
def __abs__(self):
return self.get_sectors()
@onlysectors('Can only compare sectors with sectors')
def __lt__(self, other):
return self.bytes < other.bytes

View file

@ -104,5 +104,5 @@ def test_imod_int():
b %= 5
def test_abs():
eq_(pow(1024, 3), abs(Bytes('1GiB')))
def test_convert_int():
eq_(pow(1024, 3), int(Bytes('1GiB')))

View file

@ -123,6 +123,6 @@ def test_imod_int():
s %= 5
def test_abs():
def test_convert_int():
secsize = 512
eq_(pow(1024, 3) / secsize, abs(Sectors('1GiB', secsize)))
eq_(pow(1024, 3) / secsize, int(Sectors('1GiB', secsize)))