def get_res(string): pars = mp.file2paragraphs([string]) heading = mp.extract_headings_from_par(pars)[0] return heading.is_numbered()
def test_that_headings_with_hashes_are_recognized(self): pars = {1:['#h1'], 4:['##h2']} self.assertEqual(len(mp.extract_headings_from_par(pars)), 2)
def test_that_max_headings_is_used(self): pars = {1:['jo','===='], 4:['##test']} self.assertEqual(len(mp.extract_headings_from_par(pars, 1)), 1)
def test_that_an_underlined_h2_is_extracted(self): pars = {1:['jo','---']} self.assertEqual(len(mp.extract_headings_from_par(pars)), 1)
def test_that_max_headings_is_used(self): pars = {1: ["jo", "===="], 4: ["##test"]} self.assertEqual(len(mp.extract_headings_from_par(pars, 1)), 1)
def test_that_an_underlined_h1_is_extracted(self): pars = {1: ["jo", "==="]} self.assertEqual(len(mp.extract_headings_from_par(pars)), 1)