def test_parse_multiple_start_lines_with_end_lines(self):
     change_note = "# {0}\r\nfoo\r\n\r\n# {0}\r\nbar\r\n\r\nincluded\r\n\r\n# not included".format(
         self.title
     )
     parser = ChangeNotesLinesParser(None, self.title)
     parser.parse(change_note)
     self.assertEqual(parser.content, ["foo", "bar", "included"])
 def test_parse_multi_level_indent(self):
     change_note = "# {0}\r\nfoo \r\n    bar  \r\n        baz \r\n".format(
         self.title
     )
     parser = ChangeNotesLinesParser(None, self.title)
     parser.parse(change_note)
     self.assertEqual(parser.content, ["foo", "    bar", "        baz"])
 def test_render_subheadings(self):
     parser = ChangeNotesLinesParser(None, self.title)
     parser.h2 = {"Subheading": ["foo"]}
     self.assertEqual(
         parser.render(),
         "# {}\r\n\r\n\r\n## Subheading\r\n\r\nfoo".format(self.title),
     )
 def test_render_multiple_content(self):
     parser = ChangeNotesLinesParser(None, self.title)
     content = ["foo", "bar"]
     parser.content = content
     self.assertEqual(
         parser.render(), "# {}\r\n\r\n{}".format(self.title, "\r\n".join(content))
     )
Exemple #5
0
 def test_render_one_content(self):
     parser = ChangeNotesLinesParser(None, self.title)
     content = ["foo"]
     parser.content = content
     self.assertEqual(
         parser.render(), "# {}\r\n\r\n{}".format(self.title, content[0])
     )
 def test_render_multiple_content(self):
     parser = ChangeNotesLinesParser(None, self.title)
     content = ['foo', 'bar']
     parser.content = content
     self.assertEqual(
         parser.render(), '# {}\r\n\r\n{}'.format(self.title,
                                                  '\r\n'.join(content)))
 def test_parse_subheading(self):
     change_note = "# {0}\r\n## Subheading\r\nfoo".format(self.title)
     parser = ChangeNotesLinesParser(None, self.title)
     line_added = parser.parse(change_note)
     self.assertEqual([], parser.content)
     self.assertEqual({"Subheading": ["foo"]}, parser.h2)
     self.assertTrue(line_added)
Exemple #8
0
 def _init_parsers(self):
     self.parsers.append(ChangeNotesLinesParser(
         self,
         'Critical Changes',
     ))
     self.parsers.append(ChangeNotesLinesParser(self, 'Changes'))
     self.parsers.append(GithubIssuesParser(self, 'Issues Closed'))
 def test_parse_start_line_end_at_header(self):
     change_note = "# {}\r\nfoo\r\n# Another Header\r\nbar".format(
         self.title)
     parser = ChangeNotesLinesParser(None, self.title)
     line_added = parser.parse(change_note)
     self.assertEqual(parser.content, ["foo"])
     self.assertTrue(line_added)
Exemple #10
0
 def test_render_subheadings(self):
     parser = ChangeNotesLinesParser(None, self.title)
     parser.h2 = {"Subheading": ["foo"]}
     self.assertEqual(
         parser.render(),
         "# {}\r\n\r\n\r\n## Subheading\r\n\r\nfoo".format(self.title),
     )
Exemple #11
0
 def test_render_multiple_content(self):
     parser = ChangeNotesLinesParser(None, self.title)
     content = ["foo", "bar"]
     parser.content = content
     self.assertEqual(
         parser.render(), "# {}\r\n\r\n{}".format(self.title,
                                                  "\r\n".join(content)))
 def test_parse_multiple_start_lines_with_end_lines(self):
     change_note = "# {0}\r\nfoo\r\n\r\n# {0}\r\nbar\r\n\r\nincluded\r\n\r\n# not included".format(
         self.title)
     parser = ChangeNotesLinesParser(None, self.title)
     line_added = parser.parse(change_note)
     self.assertEqual(parser.content, ["foo", "bar", "included"])
     self.assertTrue(line_added)
 def test_parse_multi_level_indent(self):
     change_note = "# {0}\r\nfoo \r\n    bar  \r\n        baz \r\n".format(
         self.title)
     parser = ChangeNotesLinesParser(None, self.title)
     line_added = parser.parse(change_note)
     self.assertEqual(parser.content, ["foo", "    bar", "        baz"])
     self.assertTrue(line_added)
Exemple #14
0
 def test_parse_subheading_from_another_section(self):
     change_note = "## Subheading\r\n# {0}\r\nfoo".format(self.title)
     parser = ChangeNotesLinesParser(None, self.title)
     line_added = parser.parse(change_note)
     self.assertEqual(["foo"], parser.content)
     self.assertEqual({}, parser.h2)
     self.assertTrue(line_added)
Exemple #15
0
 def test_render_no_content(self):
     parser = ChangeNotesLinesParser(None, self.title)
     self.assertEqual(parser.render(), None)
Exemple #16
0
 def _init_parsers(self):
     self.parsers.append(ChangeNotesLinesParser(self, "Critical Changes"))
     self.parsers.append(ChangeNotesLinesParser(self, "Changes"))
     self.parsers.append(IssuesParser(self, "Issues Closed"))
Exemple #17
0
 def test_parse_multi_level_indent(self):
     change_note = '# {0}\r\nfoo \r\n    bar  \r\n        baz \r\n'.format(
         self.title)
     parser = ChangeNotesLinesParser(None, self.title)
     parser.parse(change_note)
     self.assertEqual(parser.content, ['foo', '    bar', '        baz'])
Exemple #18
0
 def test_parse_multiple_start_lines_with_end_lines(self):
     change_note = '# {0}\r\nfoo\r\n\r\n# {0}\r\nbar\r\n\r\nincluded\r\n\r\n# not included'.format(
         self.title)
     parser = ChangeNotesLinesParser(None, self.title)
     parser.parse(change_note)
     self.assertEqual(parser.content, ['foo', 'bar', 'included'])
Exemple #19
0
 def test_parse_start_line_end_at_header(self):
     change_note = "# {}\r\nfoo\r\n# Another Header\r\nbar".format(self.title)
     parser = ChangeNotesLinesParser(None, self.title)
     parser.parse(change_note)
     self.assertEqual(parser.content, ["foo"])
Exemple #20
0
 def test_parse_start_line_no_content_no_end_line(self):
     change_note = "# {}".format(self.title)
     parser = ChangeNotesLinesParser(None, self.title)
     parser.parse(change_note)
     self.assertEqual(parser.content, [])
Exemple #21
0
 def test_parse_no_start_line(self):
     change_note = "foo\r\nbar\r\n"
     parser = ChangeNotesLinesParser(None, self.title)
     parser.parse(change_note)
     self.assertEqual(parser.content, [])
 def test_parse_start_line_no_content(self):
     change_note = "# {}\r\n\r\n".format(self.title)
     parser = ChangeNotesLinesParser(None, self.title)
     line_added = parser.parse(change_note)
     self.assertEqual(parser.content, [])
     self.assertFalse(line_added)
 def test_parse_subheading(self):
     change_note = "# {0}\r\n## Subheading\r\nfoo".format(self.title)
     parser = ChangeNotesLinesParser(None, self.title)
     parser.parse(change_note)
     self.assertEqual([], parser.content)
     self.assertEqual({"Subheading": ["foo"]}, parser.h2)
Exemple #24
0
 def test_render_no_content(self):
     parser = ChangeNotesLinesParser(None, self.title)
     self.assertEqual(parser.render(), None)
Exemple #25
0
 def test_parse_start_line_no_content_no_end_line(self):
     change_note = "# {}".format(self.title)
     parser = ChangeNotesLinesParser(None, self.title)
     parser.parse(change_note)
     self.assertEqual(parser.content, [])
Exemple #26
0
 def test_parse_start_line_no_end_line(self):
     change_note = "# {}\r\nfoo\r\nbar".format(self.title)
     parser = ChangeNotesLinesParser(None, self.title)
     parser.parse(change_note)
     self.assertEqual(parser.content, ["foo", "bar"])
Exemple #27
0
 def test_parse_start_line_end_at_header(self):
     change_note = '# {}\r\nfoo\r\n# Another Header\r\nbar'.format(
         self.title)
     parser = ChangeNotesLinesParser(None, self.title)
     parser.parse(change_note)
     self.assertEqual(parser.content, ['foo'])
Exemple #28
0
 def test_parse_multiple_start_lines_without_end_lines(self):
     change_note = "# {0}\r\nfoo\r\n# {0}\r\nbar\r\n".format(self.title)
     parser = ChangeNotesLinesParser(None, self.title)
     parser.parse(change_note)
     self.assertEqual(parser.content, ["foo", "bar"])
Exemple #29
0
 def test_parse_no_start_line(self):
     change_note = "foo\r\nbar\r\n"
     parser = ChangeNotesLinesParser(None, self.title)
     parser.parse(change_note)
     self.assertEqual(parser.content, [])