def test_property_is_valid_false(self): property_name = 'color' invalid_values = ['a pm', 'bold-50', 'whatever', '1% 5% 1% 5%', '-12.7rem', '5u5', '5pxrem', 'p12px', 'b1 a5 c1% e5', '1a% 10x% 3q% 1mp3', ] # The last two raise SyntaxErr property_parser = CSSPropertyValueParser() for value in invalid_values: self.assertFalse(property_parser.property_is_valid(name=property_name, value=value, priority=''))
def test_property_is_valid_true(self): property_name = 'color' valid_values = ['blue', 'white', '#fff', '#0ff48f', 'rgba(255, 0, 0, 0.5)', 'hsla(120, 60%, 70%, 0.3)'] property_parser = CSSPropertyValueParser() for value in valid_values: self.assertTrue(property_parser.property_is_valid(name=property_name, value=value, priority=''))