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