Exemplo n.º 1
0
 def test_FontSize(self):
     p = FontSize()
     with pytest.raises(ValueError) as e:
         p.validate("junk")
     assert not str(e).endswith("ValueError")
Exemplo n.º 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)
Exemplo n.º 3
0
 def test_FontSize(self, detail) -> None:
     p = FontSize()
     with pytest.raises(ValueError) as e:
         p.validate("junk", detail)
     assert (str(e.value) == "") == (not detail)
Exemplo n.º 4
0
 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")
Exemplo n.º 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,
Exemplo n.º 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)
Exemplo n.º 7
0
 def test_FontSize(self):
     p = FontSize()
     with pytest.raises(ValueError) as e:
         p.validate("junk")
     assert not str(e).endswith("ValueError")