Example #1
0
    def test_invalid(self) -> None:
        prop = bcpn.NonNullable(List(Int))

        assert not prop.is_valid(None)

        assert not prop.is_valid(-100)
        assert not prop.is_valid("yyy")
        assert not prop.is_valid([1, 2, ""])

        assert not prop.is_valid(())
        assert not prop.is_valid({})
        assert not prop.is_valid(_TestHasProps())
        assert not prop.is_valid(_TestModel())
Example #2
0
    def test_valid(self) -> None:
        prop = bcpn.NonNullable(List(Int))

        assert prop.is_valid([])
        assert prop.is_valid([1, 2, 3])
Example #3
0
 def test_str(self) -> None:
     prop = bcpn.NonNullable(List(Int))
     assert str(prop) == "NonNullable(List(Int))"
Example #4
0
 def test_init(self) -> None:
     with pytest.raises(TypeError):
         bcpn.NonNullable()
Example #5
0
 def test_has_ref(self) -> None:
     prop0 = bcpn.NonNullable(Int)
     assert not prop0.has_ref
     prop1 = bcpn.NonNullable(Instance(_TestModel))
     assert prop1.has_ref