예제 #1
0
 def test_un_balanced_markers_are_ignored(self):
     """Tests that lines must use balanced markers."""
     formatter = formatters.format_headers()
     self.assertEqual(apply_formatter(formatter, ['==Unbalanced===']),
                      ['==Unbalanced==='])
예제 #2
0
 def test_only_markers_are_ignored(self):
     """Tests lines with only markers aren't affected."""
     formatter = formatters.format_headers()
     self.assertEqual(apply_formatter(formatter, ['=' * 6]), ['=' * 6])
     self.assertEqual(apply_formatter(formatter, ['=' * 7]), ['=' * 7])
예제 #3
0
 def test_base_level_is_respected(self):
     """Tests changes to init level."""
     formatter = formatters.format_headers(padding=2)
     self.assertEqual(apply_formatter(formatter, ['===Only 3===']),
                      ['##### Only 3'])
예제 #4
0
 def test_inner_markers_are_ignored(self):
     """Tests header markings are only interpreted when surrounding line."""
     formatter = formatters.format_headers()
     self.assertEqual(
         apply_formatter(formatter, ['Not at =start= of text']),
         ['Not at =start= of text'])
예제 #5
0
 def test_common_format(self):
     """Tests expected usage."""
     formatter = formatters.format_headers()
     self.assertEqual(
         apply_formatter(formatter, ['=Level One=', '===Level Three===']),
         ['# Level One', '### Level Three'])