From: Vratislav Podzimek vpodzime@redhat.com
The change was enforced by the fact that the libbytesize author (me) has always found ROUND_HALF_UP confusing which is why libbytesize doesn't support ROUND_HALF_UP. The default is now ROUND_UP, but we are specifying it explicitly everywhere in our code anyway. --- tests/size_test.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/tests/size_test.py b/tests/size_test.py index 7182962..ce855ef 100644 --- a/tests/size_test.py +++ b/tests/size_test.py @@ -278,19 +278,19 @@ def test_round_to_nearest(self): self.assertEqual(size.ROUND_DEFAULT, size.ROUND_UP)
s = Size("10.3 GiB") - self.assertEqual(s.round_to_nearest(GiB), Size("10 GiB")) + self.assertEqual(s.round_to_nearest(GiB), Size("11 GiB")) self.assertEqual(s.round_to_nearest(GiB, rounding=size.ROUND_DEFAULT), - Size("10 GiB")) + Size("11 GiB")) self.assertEqual(s.round_to_nearest(GiB, rounding=size.ROUND_DOWN), Size("10 GiB")) self.assertEqual(s.round_to_nearest(GiB, rounding=size.ROUND_UP), Size("11 GiB")) # >>> Size("10.3 GiB").convert_to(MiB) # Decimal('10547.19999980926513671875') - self.assertEqual(s.round_to_nearest(MiB), Size("10547 MiB")) + self.assertIsInstance(s.round_to_nearest(MiB), Size) + self.assertEqual(s.round_to_nearest(MiB), Size("10548 MiB")) self.assertEqual(s.round_to_nearest(MiB, rounding=size.ROUND_UP), Size("10548 MiB")) - self.assertIsInstance(s.round_to_nearest(MiB), Size) with self.assertRaises(ValueError): s.round_to_nearest(MiB, rounding='abc')
@@ -315,12 +315,12 @@ def test_round_to_nearest(self): Size(0))
# test Size parameters - self.assertEqual(s.round_to_nearest(Size("128 GiB")), Size("512 GiB")) + self.assertEqual(s.round_to_nearest(Size("128 GiB"), rounding=size.ROUND_DOWN), Size("512 GiB")) self.assertEqual(s.round_to_nearest(Size("1 KiB")), Size("513 GiB")) self.assertEqual(s.round_to_nearest(Size("1 TiB")), Size("1 TiB")) self.assertEqual(s.round_to_nearest(Size("1 TiB"), rounding=size.ROUND_DOWN), Size(0)) self.assertEqual(s.round_to_nearest(Size(0)), Size(0)) - self.assertEqual(s.round_to_nearest(Size("13 GiB")), Size("507 GiB")) + self.assertEqual(s.round_to_nearest(Size("13 GiB"), rounding=size.ROUND_DOWN), Size("507 GiB"))
with self.assertRaises(ValueError): s.round_to_nearest(Size("-1 B"))
anaconda-patches@lists.fedorahosted.org