def test_line_of_index_multi_line(): text = "\nfoo\n\nbar baz\n" assert line_of_index(text, 0) == "" assert line_of_index(text, 1) == "foo" assert line_of_index(text, 2) == "foo" assert line_of_index(text, 3) == "foo" assert line_of_index(text, 4) == "foo" assert line_of_index(text, 5) == "" assert line_of_index(text, 6) == "bar baz" assert line_of_index(text, 12) == "bar baz" assert line_of_index(text, 13) == "bar baz" assert line_of_index(text, 14) == ""
def test_line_of_index_one_line(): text = "foo bar baz" assert line_of_index(text, 0) == text assert line_of_index(text, 5) == text assert line_of_index(text, len(text)) == text