def test_next_marker_none(self): """If no marker is present, return None""" with XMLBuilder("ROOT") as ctx: ctx.P("(1) 111") ctx.P("Content") ctx.P("(i) iii") self.assertIsNone(reg_text.next_marker(ctx.xml[0]))
def test_next_marker_found(self): """Find the first paragraph marker following a paragraph""" with XMLBuilder("ROOT") as ctx: ctx.P("(A) AAA") ctx.PRTPART() ctx.P("(d) ddd") ctx.P("(1) 111") self.assertEqual(reg_text.next_marker(ctx.xml[0]), 'd')
def test_next_marker_stars(self): """STARS tag has special significance.""" with XMLBuilder("ROOT") as ctx: ctx.P("(A) AAA") ctx.PRTPART() ctx.STARS() ctx.P("(d) ddd") ctx.P("(1) 111") self.assertEqual(reg_text.next_marker(ctx.xml[0]), mtypes.STARS_TAG)
def test_next_marker_stars(self): xml = etree.fromstring(""" <ROOT> <P>(i) Content</P> <STARS /> <PRTPAGE /> <STARS /> <P>(xi) More</P> </ROOT>""") self.assertEqual('xi', reg_text.next_marker(xml.getchildren()[0], []))