Example #1
0
 def testInvalidInput(self):
     """
     Test that parsing handles invalid input correctly
     """
     self.assertEquals(misc.parseHumanReadableSize("T"), 0)
     self.assertEquals(misc.parseHumanReadableSize("TNT"), 0)
     self.assertRaises(AttributeError, misc.parseHumanReadableSize, 5)
     self.assertEquals(misc.parseHumanReadableSize("4.3T"), 0)
Example #2
0
 def testInvalidInput(self):
     """
     Test that parsing handles invalid input correctly
     """
     self.assertEquals(misc.parseHumanReadableSize("T"), 0)
     self.assertEquals(misc.parseHumanReadableSize("TNT"), 0)
     self.assertRaises(AttributeError, misc.parseHumanReadableSize, 5)
     self.assertEquals(misc.parseHumanReadableSize("4.3T"), 0)
Example #3
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.assertEquals(expected, (2 ** power) * i)
Example #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.assertEquals(expected, (2 ** power) * i)