def test_object_valid_1(): """Should be ok""" class Foo(Model): bar = String() test_object = Object(model_class=Foo) test_object.validate(Foo(bar="baz")) assert True
def test_object_invalid_1(): """Wrong type""" class Foo(Model): bar = String() test_object = Object(model_class=Foo) with assert_raises(InvalidPropertyError) as cm: test_object.validate("foo") assert cm.exception.error == 'invalid'