Esempio n. 1
0
def test_removeCB():
    checkfail(RequireChild(Strong))
    tree = setup()
    sc = SanityChecker()
    sc.addRule(RequireChild(Strong), removecb)  # this removes the
    sc.check(tree)
    # now traverse this tree and assert there is no strong
    for c in tree.allchildren():
        assert not isinstance(c, Strong)
Esempio n. 2
0
def checkfail(*rules):
    tree = setup()
    sc = SanityChecker()
    for r in rules:
        sc.addRule(r)
    failed = False
    try:
        sc.check(tree)
    except SanityException:
        failed = True
    assert failed
Esempio n. 3
0
def test_removeCB():
    checkfail(RequireChild(Strong))
    tree = setup()
    sc = SanityChecker()
    sc.addRule(RequireChild(Strong), removecb)  # this removes the
    sc.check(tree)
    # now traverse this tree and assert there is no strong
    for c in tree.allchildren():
        assert not isinstance(c, Strong)
Esempio n. 4
0
def checkfail(*rules):
    tree = setup()
    sc = SanityChecker()
    for r in rules:
        sc.addRule(r)
    failed = False
    try:
        sc.check(tree)
    except SanityException:
        failed = True
    assert failed
Esempio n. 5
0
def checkpass(*rules):
    tree = setup()
    sc = SanityChecker()
    for r in rules:
        sc.addRule(r)
    sc.check(tree)  # should pass
Esempio n. 6
0
def checkpass(*rules):
    tree = setup()
    sc = SanityChecker()
    for r in rules:
        sc.addRule(r)
    sc.check(tree)  # should pass