示例#1
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)))
示例#2
0
 def test_render_no_content(self):
     parser = ChangeNotesLinesParser(None, self.title)
     self.assertEqual(parser.render(), None)
示例#3
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]))
示例#4
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'])
示例#5
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, [])
示例#6
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'])
示例#7
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, [])
示例#8
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'])