Пример #1
0
def ssam(expr, string, echo_input=True):
    selections = ""
    if expr:
        string, selections = call(parse(expr), string)
    if selections:
        print("".join(map(str, selections)), end="")
    if echo_input:
        print(string, end="")
Пример #2
0
def test_extract():
    assert ("x", "regexp", None) == se.parse("x/regexp/")
    assert ("x", "string", None) == se.parse("x/string/")
Пример #3
0
def test_empty_expression():
    assert None == se.parse("")
Пример #4
0
def test_escaped_backslash():
    assert ("x", r"\/", None) == se.parse(r"x/\//")
Пример #5
0
def test_extract_lines_and_print_if():
    assert ("x", r".*\n", ("g", "string",
                           "p")) == se.parse(r"x/.*\n/ g/string/p")
Пример #6
0
def test_extract_and_delete():
    assert ("x", "regexp", "d") == se.parse("x/regexp/d")