示例#1
0
文件: tests.py 项目: alonho/asserter
def test_list():
    orig = range(10)
    l = Asserter(orig)
    l.is_(orig)

    l.length() == 10
    with assert_raises():
        l.length() == 9
示例#2
0
文件: tests.py 项目: alonho/asserter
def test_nested():
    orig = Dog(13)
    obj = Asserter(orig)

    obj.is_(orig)
    obj.isinstance(Dog)
    with assert_raises():
        obj.isinstance(int)

    obj.say() == "woof"

    with assert_raises():
        obj.say() == "quack"

    obj.age == 13
    with assert_raises():
        obj.age == 15