def test_line_offsets_multiple_lines(): src = 'hello\nworld\n' ret = get_line_offsets_by_line_no(src) assert ret == [None, 0, 6, 12] # To demonstrate how it is used: acquire everything from line 2 onwards assert src[ret[2]:] == 'world\n'
def test_line_offsets_eof_newline(): assert get_line_offsets_by_line_no('hello\n') == [None, 0, 6]
def test_line_offsets_trivial(): assert get_line_offsets_by_line_no('') == [None, 0]
def test_line_offsets_multiple_lines(): src = 'hello\nworld\n' ret = get_line_offsets_by_line_no(src) assert ret == [None, 0, 6, 12] # To demonstrate how it is used: acquire everything from line 2 onwards assert src[ret[2]:] == 'world\n'
def test_line_offsets_eof_newline(): assert get_line_offsets_by_line_no('hello\n') == [None, 0, 6]
def test_line_offsets_trivial(): assert get_line_offsets_by_line_no('') == [None, 0]