Пример #1
0
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
Пример #2
0
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
Пример #3
0
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'
Пример #4
0
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'