Esempio 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
Esempio 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
Esempio 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
Esempio 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
Esempio 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"
Esempio 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"
Esempio n. 7
0
 def test_no_comments(self):
     data = [
         "128y9h12789y", "  s", "  ", "-..s", "  -.", "", "",
         ".. image: here.jpg", ""
     ]
     assert list(commentless(data)) == data
Esempio 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"
Esempio 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"
Esempio n. 10
0
 def test_no_comments(self):
     data = ["128y9h12789y", "  s", "  ", "-..s", "  -.", "", "",
             ".. image: here.jpg", ""]
     assert list(commentless(data)) == data