예제 #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"))
예제 #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"))
예제 #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')
예제 #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+")
예제 #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]—')
예제 #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+")
예제 #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]—')
예제 #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)
예제 #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")