Beispiel #1
0
 def test_FontSize(self):
     p = FontSize()
     with pytest.raises(ValueError) as e:
         p.validate("junk")
     assert not str(e).endswith("ValueError")
Beispiel #2
0
 def test_FontSize(self, detail):
     p = FontSize()
     with pytest.raises(ValueError) as e:
         p.validate("junk", detail)
     assert str(e).endswith("ValueError") == (not detail)
 def test_FontSize(self, detail) -> None:
     p = FontSize()
     with pytest.raises(ValueError) as e:
         p.validate("junk", detail)
     assert (str(e.value) == "") == (not detail)
 def test_FontSize(self) -> None:
     p = FontSize()
     with pytest.raises(ValueError) as e:
         p.validate("junk")
     assert matches(str(e.value), r"'junk' is not a valid font size value")
Beispiel #5
0
                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,
Beispiel #6
0
 def test_FontSize(self, detail):
     p = FontSize()
     with pytest.raises(ValueError) as e:
         p.validate("junk", detail)
     assert str(e).endswith("ValueError") == (not detail)
Beispiel #7
0
 def test_FontSize(self):
     p = FontSize()
     with pytest.raises(ValueError) as e:
         p.validate("junk")
     assert not str(e).endswith("ValueError")