예제 #1
0
    def test_valid(self) -> None:
        prop = bcpv.DashPattern()

        assert prop.is_valid("")
        assert prop.is_valid(())
        assert prop.is_valid([])

        assert prop.is_valid("solid")
        assert prop.is_valid("dashed")
        assert prop.is_valid("dotted")
        assert prop.is_valid("dotdash")
        assert prop.is_valid("dashdot")

        assert prop.is_valid([1, 2, 3])
        assert prop.is_valid("1 2 3")
    def test_invalid(self):
        prop = bcpv.DashPattern()

        assert not prop.is_valid(False)
        assert not prop.is_valid(True)
        assert not prop.is_valid(0)
        assert not prop.is_valid(1)
        assert not prop.is_valid(0.0)
        assert not prop.is_valid(1.0)
        assert not prop.is_valid(1.0+1.0j)

        assert not prop.is_valid("foo")
        assert not prop.is_valid("DASHDOT")

        assert not prop.is_valid([1, 2, 3.0])
        assert not prop.is_valid("1 2 x")

        assert not prop.is_valid(_TestHasProps())
        assert not prop.is_valid(_TestModel())
 class Foo(HasProps):
     pat = bcpv.DashPattern()
 def test_str(self):
     prop = bcpv.DashPattern()
     assert str(prop) == "DashPattern"
 def test_has_ref(self):
     prop = bcpv.DashPattern()
     assert not prop.has_ref