예제 #1
0
파일: misc_test.py 프로젝트: k0ste/vdsm
 def testInvalidInput(self):
     """
     Test that parsing handles invalid input correctly
     """
     self.assertEqual(misc.parseHumanReadableSize("T"), 0)
     self.assertEqual(misc.parseHumanReadableSize("TNT"), 0)
     self.assertRaises(AttributeError, misc.parseHumanReadableSize, 5)
     self.assertEqual(misc.parseHumanReadableSize("4.3T"), 0)
예제 #2
0
 def testInvalidInput(self):
     """
     Test that parsing handles invalid input correctly
     """
     self.assertEqual(misc.parseHumanReadableSize("T"), 0)
     self.assertEqual(misc.parseHumanReadableSize("TNT"), 0)
     self.assertRaises(AttributeError, misc.parseHumanReadableSize, 5)
     self.assertEqual(misc.parseHumanReadableSize("4.3T"), 0)
예제 #3
0
파일: misc_test.py 프로젝트: k0ste/vdsm
 def testValidInput(self):
     """
     Test that the method parses size correctly if given correct input.
     """
     for i in range(1, 1000):
         for schar, power in [("T", 40), ("G", 30), ("M", 20), ("K", 10)]:
             expected = misc.parseHumanReadableSize("%d%s" % (i, schar))
             self.assertEqual(expected, (2**power) * i)
예제 #4
0
 def testValidInput(self):
     """
     Test that the method parses size correctly if given correct input.
     """
     for i in range(1, 1000):
         for schar, power in [("T", 40), ("G", 30), ("M", 20), ("K", 10)]:
             expected = misc.parseHumanReadableSize("%d%s" % (i, schar))
             self.assertEqual(expected, (2 ** power) * i)