Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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'
Ejemplo n.º 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'