def test_MarkerType(self) -> None: p = MarkerType() with pytest.raises(ValueError) as e: p.validate("foo") assert matches( str(e.value), r"invalid value: 'foo'; allowed values are asterisk, .* or x")
def test_MarkerType(self, detail): p = MarkerType() with pytest.raises(ValueError) as e: p.validate("foo", detail) assert str(e).endswith("ValueError") == (not detail)
def test_MarkerType(self): p = MarkerType() with pytest.raises(ValueError) as e: p.validate("foo") assert not str(e).endswith("ValueError")
def test_MarkerType(self, detail) -> None: p = MarkerType() with pytest.raises(ValueError) as e: p.validate("foo", detail) assert (str(e.value) == "") == (not detail)
v = rgb2hex(v) new_properties[k] = v else: new_properties[k] = v new_properties.pop('cmap', None) return new_properties # Validation alpha = Percent() angle = Angle() color = Color() dash_pattern = DashPattern() font_size = FontSize() marker = MarkerType() size = Size() validators = { 'angle': angle.is_valid, 'alpha': alpha.is_valid, 'color': lambda x: (color.is_valid(x) or (isinstance(x, basestring) and RGB_HEX_REGEX.match(x))), 'font_size': font_size.is_valid, 'line_dash': dash_pattern.is_valid, 'marker':
def test_MarkerType(self, detail): p = MarkerType() with pytest.raises(ValueError) as e: p.validate("foo", detail) assert str(e).endswith("ValueError") == (not detail)
def test_MarkerType(self): p = MarkerType() with pytest.raises(ValueError) as e: p.validate("foo") assert not str(e).endswith("ValueError")
with abbreviated_exception(): v = rgb2hex(v) new_properties[k] = v else: new_properties[k] = v new_properties.pop('cmap', None) return new_properties # Validation alpha = Percent() angle = Angle() color = Color() dash_pattern = DashPattern() font_size = FontSize() marker = MarkerType() size = Size() validators = { 'angle' : angle.is_valid, 'alpha' : alpha.is_valid, 'color' : lambda x: ( color.is_valid(x) or (isinstance(x, basestring) and RGB_HEX_REGEX.match(x)) ), 'font_size' : font_size.is_valid, 'line_dash' : dash_pattern.is_valid, 'marker' : lambda x: marker.is_valid(x) or x in markers, 'size' : size.is_valid, } def get_validator(style):