Example #1
0
def test_transformer_list_not_eq():
    assert ListTransformer([
        InsertBeforeRegexTransformer(re.compile("test"), "BEFORE"),
        InsertAfterRegexTransformer(re.compile("test"), "AFTER")
    ]) != ListTransformer([
        InsertBeforeRegexTransformer(re.compile("test"), "BEFORE"),
        InsertAfterRegexTransformer(re.compile("test"), "AFTER2")
    ])
Example #2
0
def test_before_several_matches():
    assert InsertBeforeRegexTransformer(
        re.compile("test"), "BEFORE").transform(
            "AAAtestBBBtestCCC") == "AAABEFOREtestBBBBEFOREtestCCC"
Example #3
0
def test_before_partial_line_matches():
    assert InsertBeforeRegexTransformer(
        re.compile("test"),
        "BEFORE").transform("aaatestaaa") == "aaaBEFOREtestaaa"
Example #4
0
def test_before_whole_line_matches():
    assert InsertBeforeRegexTransformer(
        re.compile("test"), "BEFORE").transform("test") == "BEFOREtest"
Example #5
0
def test_transformer_before_not_eq():
    assert InsertBeforeRegexTransformer(
        re.compile("test"), "BEFORE") != InsertBeforeRegexTransformer(
            re.compile("test"), "BEFORE2")
Example #6
0
def test_transformer_list_str():
    assert ListTransformer([
        InsertBeforeRegexTransformer(re.compile("test"), "BEFORE"),
        InsertAfterRegexTransformer(re.compile("test"), "AFTER")
    ]).__str__(
    ) == 'insert "BEFORE" before "test"\ninsert "AFTER" after "test"'
Example #7
0
def test_transformer_before_str():
    assert InsertBeforeRegexTransformer(
        re.compile("test"),
        "BEFORE").__str__() == 'insert "BEFORE" before "test"'
Example #8
0
def test_list_transformer():
    assert ListTransformer([
        InsertBeforeRegexTransformer(re.compile("test"), "BEFORE"),
        InsertAfterRegexTransformer(re.compile("test"), "AFTER")
    ]).transform("test") == "BEFOREtestAFTER"
Example #9
0
def test_before_only_match_whole_line():
    assert InsertBeforeRegexTransformer(re.compile("^test$"),
                                        "BEFORE").transform("testA") == "testA"