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