[blivet:rhel7 1/6] Fix some size_test.py ERRORs (#1065443)
mulhern
amulhern at redhat.com
Mon Feb 17 22:08:20 UTC 2014
Resolves: rhbz#1065443
Cherry-picked from commit 01c6949ee336e3bb3861a9e94280f5ec1dcc62b4.
Signed-off-by: mulhern <amulhern at redhat.com>
---
tests/size_test.py | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/tests/size_test.py b/tests/size_test.py
index 6688f08..f007798 100644
--- a/tests/size_test.py
+++ b/tests/size_test.py
@@ -23,8 +23,6 @@
import unittest
-from pyanaconda import anaconda_log
-anaconda_log.init()
from blivet.errors import *
from blivet.size import Size, _prefixes
@@ -35,12 +33,16 @@ class SizeTestCase(unittest.TestCase):
self.assertRaises(SizeNotPositiveError, Size, bytes=-1)
- self.assertRaises(SizeNotPositiveError, Size, spec="0")
+ zero = Size(bytes=0)
+ self.assertEqual(zero, 0.0)
+
self.assertRaises(SizeNotPositiveError, Size, spec="-1 TB")
self.assertRaises(SizeNotPositiveError, Size, spec="-47kb")
s = Size(bytes=500)
- self.assertRaises(SizePlacesError, s.humanReadable, places=0)
+ self.assertRaises(SizePlacesError, s.humanReadable, places=-1)
+
+ self.assertEqual(s.humanReadable(places=0), "500 B")
def _prefixTestHelper(self, bytes, factor, prefix, abbr):
c = bytes * factor
@@ -74,10 +76,10 @@ class SizeTestCase(unittest.TestCase):
def testHumanReadable(self):
s = Size(bytes=58929971L)
- self.assertEquals(s.humanReadable(), "58.9 Mb")
+ self.assertEquals(s.humanReadable(), "58.92 MB")
s = Size(bytes=478360371L)
- self.assertEquals(s.humanReadable(), "0.48 Gb")
+ self.assertEquals(s.humanReadable(), "478.36 MB")
def testTranslated(self):
import locale
--
1.8.3.1
More information about the anaconda-patches
mailing list