Exemple #1
0
def test_seek_first_line_of_text():
    text = io.StringIO("one\ntwo\nthree")
    assert_equal("one", textseek.seek_line(text, 1))
Exemple #2
0
def _print_location(location):
    print("File '{}', line {}, col {}".format(location.filename, location.lineno, location.offset))
    print()
    with open(location.filename) as source_file:
        print("  " + textseek.seek_line(source_file, location.lineno))
    print(" " * (2 + location.offset) + "^")
Exemple #3
0
def test_seek_line_of_text_in_middle():
    text = io.StringIO("one\ntwo\nthree")
    assert_equal("two", textseek.seek_line(text, 2))