From: "David Lehman" <dlehman(a)redhat.com>
To: anaconda-patches(a)lists.fedorahosted.org
Sent: Friday, September 26, 2014 1:28:31 PM
Subject: [PATCH] Add a test for convertTo's precision.
---
tests/size_test.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tests/size_test.py b/tests/size_test.py
index e2288e0..95f2c1d 100644
--- a/tests/size_test.py
+++ b/tests/size_test.py
@@ -104,6 +104,12 @@ class SizeTestCase(unittest.TestCase):
s = Size("12.6998 TiB")
self.assertEquals(s.humanReadable(max_places=2), "12.7 TiB")
+ def testConvertToPrecision(self):
+ s = Size(1835008)
+ self.assertEquals(s.convertTo(spec="b"), 1835008)
+ self.assertEquals(s.convertTo(spec="KiB", 1792)
+ self.assertEquals(s.convertTo(spec="MiB", 1.75))
+
def testNegative(self):
s = Size("-500MiB")
self.assertEquals(s.humanReadable(), "-500 MiB")
--
1.9.3
_______________________________________________
anaconda-patches mailing list
anaconda-patches(a)lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
Thanks for the test. This hadn't landed yet, when I was reviewing the change.
- mulhern