Пример #1
0
    def test_invalid(self):
        prop = bcpc.Array(Float)

        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("")
        assert not prop.is_valid(())
        assert not prop.is_valid([])
        assert not prop.is_valid({})

        assert not prop.is_valid(_TestHasProps())
        assert not prop.is_valid(_TestModel())
Пример #2
0
 def test_str(self):
     prop = bcpc.Array(Float)
     assert str(prop) == "Array(Float)"
Пример #3
0
 def test_has_ref(self):
     prop = bcpc.Array(Float)
     assert not prop.has_ref
Пример #4
0
    def test_valid(self):
        prop = bcpc.Array(Float)

        assert prop.is_valid(None)
        assert prop.is_valid(np.array([1, 2, 3]))
Пример #5
0
 def test_init(self):
     with pytest.raises(TypeError):
         bcpc.Array()