Exemple #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")
    ])
Exemple #2
0
def test_before_several_matches():
    assert InsertBeforeRegexTransformer(
        re.compile("test"), "BEFORE").transform(
            "AAAtestBBBtestCCC") == "AAABEFOREtestBBBBEFOREtestCCC"
Exemple #3
0
def test_before_partial_line_matches():
    assert InsertBeforeRegexTransformer(
        re.compile("test"),
        "BEFORE").transform("aaatestaaa") == "aaaBEFOREtestaaa"
Exemple #4
0
def test_before_whole_line_matches():
    assert InsertBeforeRegexTransformer(
        re.compile("test"), "BEFORE").transform("test") == "BEFOREtest"
Exemple #5
0
def test_transformer_before_not_eq():
    assert InsertBeforeRegexTransformer(
        re.compile("test"), "BEFORE") != InsertBeforeRegexTransformer(
            re.compile("test"), "BEFORE2")
Exemple #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"'
Exemple #7
0
def test_transformer_before_str():
    assert InsertBeforeRegexTransformer(
        re.compile("test"),
        "BEFORE").__str__() == 'insert "BEFORE" before "test"'
Exemple #8
0
def test_list_transformer():
    assert ListTransformer([
        InsertBeforeRegexTransformer(re.compile("test"), "BEFORE"),
        InsertAfterRegexTransformer(re.compile("test"), "AFTER")
    ]).transform("test") == "BEFOREtestAFTER"
Exemple #9
0
def test_before_only_match_whole_line():
    assert InsertBeforeRegexTransformer(re.compile("^test$"),
                                        "BEFORE").transform("testA") == "testA"