Ejemplo n.º 1
0
 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
Ejemplo n.º 2
0
 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
Ejemplo n.º 3
0
 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
Ejemplo n.º 4
0
 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
Ejemplo n.º 5
0
 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"
Ejemplo n.º 6
0
 def test_single_line_comments_endless(self):
     result = commentless(self.endless_data)
     for idx, line in zip(range(30), result):
         assert line == "again"
Ejemplo n.º 7
0
 def test_no_comments(self):
     data = [
         "128y9h12789y", "  s", "  ", "-..s", "  -.", "", "",
         ".. image: here.jpg", ""
     ]
     assert list(commentless(data)) == data
Ejemplo n.º 8
0
 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"
Ejemplo n.º 9
0
 def test_single_line_comments_endless(self):
     result = commentless(self.endless_data)
     for idx, line in zip(range(30), result):
         assert line == "again"
Ejemplo n.º 10
0
 def test_no_comments(self):
     data = ["128y9h12789y", "  s", "  ", "-..s", "  -.", "", "",
             ".. image: here.jpg", ""]
     assert list(commentless(data)) == data