Exemple #1
0
 def test_parse_decimal(self):
     self.assertEqual(Information.parse('1.4 GB'),
                      Information(10**9 * 1.4 * 8, Information.BITS))
Exemple #2
0
 def test_parse_integer(self):
     self.assertEqual(Information.parse('123 YiB'),
                      Information(2**80 * 123 * 8, Information.BITS))
Exemple #3
0
 def test_parse_invalid_number(self):
     with self.assertRaises(ValueError):
         Information.parse('1.2.3 TiB')
Exemple #4
0
 def test_parse_invalid_unit(self):
     with self.assertRaises(ValueError):
         Information.parse('1 TiBoo')
Exemple #5
0
 def test_parse_rubbish(self):
     with self.assertRaises(ValueError):
         Information.parse('rubbish')