def test_multiline_unstable_indentation_with_empty_lines(self): result = commentless([ ".. comment", "", " indented data", " ", " more indented data", " ending", "continuation", ] * 3) assert isinstance(result, collections.Iterator) assert list(result) == ["continuation"] * 3
def test_links_arent_comments(self): data = [ "Text text text.", "", ".. _`some link`:", " protocol://some.where.in/the/web", "", "", ".. some comment here", "", "Title", "-----", ] expected_once = data[:-4] + data[-2:] result = commentless(data * 2) assert isinstance(result, collections.Iterator) assert list(result) == expected_once * 2
def test_multiline_comment_continuation_indented(self): result = commentless(" _" if line.endswith("end") else line for line in self.endless_data) for idx, line in zip(range(30), result): assert line == "again"
def test_single_line_comments_endless(self): result = commentless(self.endless_data) for idx, line in zip(range(30), result): assert line == "again"
def test_no_comments(self): data = [ "128y9h12789y", " s", " ", "-..s", " -.", "", "", ".. image: here.jpg", "" ] assert list(commentless(data)) == data
def test_no_comments(self): data = ["128y9h12789y", " s", " ", "-..s", " -.", "", "", ".. image: here.jpg", ""] assert list(commentless(data)) == data