def test_units_parser(self): assert v2v._parse_allocation_units("byte") == 1 assert v2v._parse_allocation_units("byte * 10") == 10 assert v2v._parse_allocation_units("byte * +10") == 10 assert v2v._parse_allocation_units("byte * 2 ^ 1") == 2 assert v2v._parse_allocation_units("byte * 2 ^ 10") == 1024 assert v2v._parse_allocation_units("byte * 2 ^ +10") == 1024 assert v2v._parse_allocation_units("byte * 10 * 2^3") == 80 assert v2v._parse_allocation_units("byte*10*2^3") == 80 # We don't support other units! with pytest.raises(v2v.V2VError): v2v._parse_allocation_units("volt")
def test_units_parser(self): self.assertEqual(v2v._parse_allocation_units("byte"), 1) self.assertEqual(v2v._parse_allocation_units("byte * 10"), 10) self.assertEqual(v2v._parse_allocation_units("byte * +10"), 10) self.assertEqual(v2v._parse_allocation_units("byte * 2 ^ 1"), 2) self.assertEqual(v2v._parse_allocation_units("byte * 2 ^ 10"), 1024) self.assertEqual(v2v._parse_allocation_units("byte * 2 ^ +10"), 1024) self.assertEqual(v2v._parse_allocation_units("byte * 10 * 2^3"), 80) self.assertEqual(v2v._parse_allocation_units("byte*10*2^3"), 80) # We don't support other units! self.assertRaises(v2v.V2VError, v2v._parse_allocation_units, "volt")
def test_units_parser(self): self.assertEqual(v2v._parse_allocation_units("byte"), 1) self.assertEqual(v2v._parse_allocation_units("byte * 10"), 10) self.assertEqual(v2v._parse_allocation_units("byte * +10"), 10) self.assertEqual(v2v._parse_allocation_units("byte * 2 ^ 1"), 2) self.assertEqual(v2v._parse_allocation_units("byte * 2 ^ 10"), 1024) self.assertEqual(v2v._parse_allocation_units("byte * 2 ^ +10"), 1024) self.assertEqual(v2v._parse_allocation_units("byte * 10 * 2^3"), 80) self.assertEqual(v2v._parse_allocation_units("byte*10*2^3"), 80) # We don't support other units! self.assertRaises(v2v.V2VError, v2v._parse_allocation_units, "volt")