def test_first_character_chapter(self): """Insert a tab for first paragraph of a chapter.""" rules = self._create_rules_prose_first_char() state = State() state.previous_line.is_blank = True state.is_first_paragraph = True state.markup.is_chapter = True state.markup.is_section = False self.assertEqual(rules.first_character(state), '\t') self.assertEqual(rules.first_character(state, use_spaces=True), ' ') rules.options.compile.paragraph.mode = 'justified' self.assertEqual(rules.first_character(state), '') self.assertEqual(rules.first_character(state, use_spaces=True), '')
def test_first_character_not_first_line(self): """Don't insert a tab if the previous line isn't blank.""" rules = self._create_rules_prose_first_char() state = State() state.previous_line.is_blank = False state.is_first_paragraph = False state.is_chapter = False state.is_section = False self.assertEqual(rules.first_character(state), '') self.assertEqual(rules.first_character(state, use_spaces=True), '') rules.options.compile.paragraph.mode = 'justified' self.assertEqual(rules.first_character(state), '') self.assertEqual(rules.first_character(state, use_spaces=True), '')