def test_too_long(self): long_text = 'Hea' + 'd' * 200 + 'ing' self.assertEqual( 'Title B', HeadingHeuristics.get_better_title(long_text, 'Title B'))
def test_old_better(self): self.assertEqual( 'II.IV Some title', HeadingHeuristics.get_better_title('II.IV Some title', 'II.IV Some other title'))
def test_too_short(self): self.assertEqual('Title B', HeadingHeuristics.get_better_title('B', 'Title B')) self.assertEqual('A', HeadingHeuristics.get_better_title('A', 'B2'))