示例#1
0
def test_seek_first_line_of_text():
    text = io.StringIO("one\ntwo\nthree")
    assert_equal("one", textseek.seek_line(text, 1))
示例#2
0
文件: main.py 项目: mwilliamson/nope
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) + "^")
示例#3
0
def test_seek_line_of_text_in_middle():
    text = io.StringIO("one\ntwo\nthree")
    assert_equal("two", textseek.seek_line(text, 2))