Exemple #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"))
Exemple #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"))
Exemple #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')
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+")
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]—')
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+")
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]—')
def find_supplement_start(text, supplement='I'):
    """Find the start of the supplement (e.g. Supplement I)"""
    return find_start(text, 'Supplement', supplement)
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")