Example #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)
Example #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
Example #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)
Example #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
Example #5
0
def checkpass(*rules):
    tree = setup()
    sc = SanityChecker()
    for r in rules:
        sc.addRule(r)
    sc.check(tree)  # should pass
Example #6
0
def checkpass(*rules):
    tree = setup()
    sc = SanityChecker()
    for r in rules:
        sc.addRule(r)
    sc.check(tree)  # should pass