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