Exemplo n.º 1
0
 def test_find_start(self):
     text = "Here is \n Some text\nWith Some\nHeader Info Here"
     text += "\nthen nonsense"
     self.assertEqual(30, search.find_start(text, "Header", "Info"))
     self.assertEqual(0, search.find_start(text, "Here", "is"))
     self.assertEqual(47, search.find_start(text, "then", "nonsense"))
     self.assertEqual(None, search.find_start(text, "doesn't", "exist"))
     self.assertEqual(None, search.find_start(text, "Here", "text"))
Exemplo n.º 2
0
 def test_find_start(self):
     text = "Here is \n Some text\nWith Some\nHeader Info Here"
     text += "\nthen nonsense"
     self.assertEqual(30, search.find_start(text, "Header", "Info"))
     self.assertEqual(0, search.find_start(text, "Here", "is"))
     self.assertEqual(47, search.find_start(text, "then", "nonsense"))
     self.assertEqual(None, search.find_start(text, "doesn't", "exist"))
     self.assertEqual(None, search.find_start(text, "Here", "text"))
Exemplo n.º 3
0
def find_appendix_start(text):
    """Find the start of the appendix (e.g. Appendix A)"""
    return search.find_start(text, 'Appendix', r'[A-Z] to Part')
Exemplo n.º 4
0
def find_next_section_start(text, part):
    """Find the start of the next section (e.g. 205.14)"""
    return find_start(text, u"§", str(part) + r"\.\d+")
Exemplo n.º 5
0
def find_next_subpart_start(text):
    """ Find the start of the next Subpart (e.g. Subpart B)"""
    return find_start(text, u'Subpart', ur'[A-Z]—')
Exemplo n.º 6
0
def find_next_section_start(text, part):
    """Find the start of the next section (e.g. 205.14)"""
    return find_start(text, "§", str(part) + r"\.\d+")
Exemplo n.º 7
0
def find_next_subpart_start(text):
    """ Find the start of the next Subpart (e.g. Subpart B)"""
    return find_start(text, 'Subpart', r'[A-Z]—')
Exemplo n.º 8
0
def find_supplement_start(text, supplement='I'):
    """Find the start of the supplement (e.g. Supplement I)"""
    return find_start(text, 'Supplement', supplement)
Exemplo n.º 9
0
def find_appendix_start(text):
    """Find the start of the appendix (e.g. Appendix A)"""
    return search.find_start(text, "Appendix", r"[A-Z] to Part")