예제 #1
0
def test_tags(
    test_rules_collection: RulesCollection,
    ematchtestfile: Lintable,
    bracketsmatchtestfile: Lintable,
) -> None:
    matches = test_rules_collection.run(ematchtestfile, tags={'test1'})
    assert len(matches) == 3
    matches = test_rules_collection.run(ematchtestfile, tags={'test2'})
    assert len(matches) == 0
    matches = test_rules_collection.run(bracketsmatchtestfile, tags={'test1'})
    assert len(matches) == 0
    matches = test_rules_collection.run(bracketsmatchtestfile, tags={'test2'})
    assert len(matches) == 2
예제 #2
0
def test_skip_id(
    test_rules_collection: RulesCollection,
    ematchtestfile: Lintable,
    bracketsmatchtestfile: Lintable,
) -> None:
    matches = test_rules_collection.run(ematchtestfile, skip_list=['TEST0001'])
    assert len(matches) == 0
    matches = test_rules_collection.run(ematchtestfile, skip_list=['TEST0002'])
    assert len(matches) == 3
    matches = test_rules_collection.run(bracketsmatchtestfile,
                                        skip_list=['TEST0001'])
    assert len(matches) == 2
    matches = test_rules_collection.run(bracketsmatchtestfile,
                                        skip_list=['TEST0002'])
    assert len(matches) == 0
예제 #3
0
def test_run_collection(test_rules_collection: RulesCollection,
                        ematchtestfile: Lintable) -> None:
    matches = test_rules_collection.run(ematchtestfile)
    assert len(matches) == 3  # 3 occurrences of BANNED using TEST0001
    assert matches[0].linenumber == 2
예제 #4
0
def test_skip_non_existent_id(test_rules_collection: RulesCollection,
                              ematchtestfile: Lintable) -> None:
    matches = test_rules_collection.run(ematchtestfile,
                                        skip_list=['DOESNOTEXIST'])
    assert len(matches) == 3