From b537f2d987088273788ee5f5eb9d551720f319a1 Mon Sep 17 00:00:00 2001 From: Anders Ingemann Date: Fri, 2 Jan 2015 15:12:48 +0100 Subject: [PATCH] Remove __abs__ from bytes and sectors, one should convert to int instead --- bootstrapvz/common/bytes.py | 3 --- bootstrapvz/common/sectors.py | 3 --- tests/unit/bytes.py | 4 ++-- tests/unit/sectors.py | 4 ++-- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/bootstrapvz/common/bytes.py b/bootstrapvz/common/bytes.py index d558aa6..f1e48ba 100644 --- a/bootstrapvz/common/bytes.py +++ b/bootstrapvz/common/bytes.py @@ -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 diff --git a/bootstrapvz/common/sectors.py b/bootstrapvz/common/sectors.py index ecdbc49..23679e7 100644 --- a/bootstrapvz/common/sectors.py +++ b/bootstrapvz/common/sectors.py @@ -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 diff --git a/tests/unit/bytes.py b/tests/unit/bytes.py index 19e8b08..7c95797 100644 --- a/tests/unit/bytes.py +++ b/tests/unit/bytes.py @@ -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'))) diff --git a/tests/unit/sectors.py b/tests/unit/sectors.py index b15bac7..7a86ae9 100644 --- a/tests/unit/sectors.py +++ b/tests/unit/sectors.py @@ -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)))