Esempio n. 1
0
def test_incorrect_mark_bug():
    lines = Lines([
        "/tests/test",
    ])
    term = "/test"
    assert list(search(lines, term)) == [
        (0, [(0, 5), (6, 11)]),
    ]
Esempio n. 2
0
def test_repeat():
    lines = Lines([
        "aaa",
    ])
    term = "aa"
    assert list(search(lines, term)) == [
        (0, [(0, 2)]),
    ]
Esempio n. 3
0
def test_multiple_terms():
    lines = Lines([
        "one of them",
        "two",
    ])
    term = "ne th"
    assert list(search(lines, term)) == [
        (0, [(1, 3), (7, 9)]),
    ]
Esempio n. 4
0
def test_uses_case():
    lines = Lines([
        "hone",
        "tHree",
    ])
    term = "H"
    assert list(search(lines, term)) == [
        (1, [(1, 2)]),
    ]
Esempio n. 5
0
def test_ignores_case():
    lines = Lines([
        "hone",
        "tHree",
    ])
    term = "h"
    assert list(search(lines, term)) == [
        (0, [(0, 1)]),
        (1, [(1, 2)]),
    ]
Esempio n. 6
0
def test_re():
    lines = Lines([
        "one",
        "some].*chars",
        "three",
    ])
    term = "].*"
    assert list(search(lines, term)) == [
        (1, [(4, 7)]),
    ]
Esempio n. 7
0
def test_filter():
    lines = Lines([
        "one",
        "two",
        "three",
    ])
    term = "t"
    assert list(search(lines, term)) == [
        (1, [(0, 1)]),
        (2, [(0, 1)]),
    ]
Esempio n. 8
0
def get_lines(binary):
    lines = Lines.from_stream(StringIO(binary))
    return [lines.get(index) for index in range(lines.count())]
Esempio n. 9
0
def create_controller(tab_exits=False):
    screen = Mock()
    screen.getmaxyx.return_value = (100, 100)
    controller = UiController(Lines([]), "", lambda x, y: [], tab_exits)
    controller.setup(screen)
    return controller