def test_titles(self):
     """Validate various titles for the parent"""
     tagged_text = '<E T="03">Abc.</E> A paragraph'
     ref = def_finders.Ref('abc', None, 0)
     self.assert_finds_result(tagged_text, 'Definition.', ref)
     self.assert_finds_result(tagged_text, 'Definition', ref)
     self.assert_finds_result(tagged_text, 'Meaning of terms', ref)
     self.assert_finds_result(tagged_text, 'Meaning Of Terms?', ref)
     self.assert_finds_result(tagged_text, 'Some other defs')    # no match
 def test_find(self):
     """Tests several examples involving smart quotes"""
     self.assert_finds_definition(u'This has a “worD” and then more',
                                  def_finders.Ref('word', None, 12))
     self.assert_finds_definition(u'I have “anotheR word” term and “moree”',
                                  def_finders.Ref('another word', None, 8),
                                  def_finders.Ref('moree', None, 32))
     self.assert_finds_definition(u'But the child “DoeS sEe”?',
                                  def_finders.Ref('does see', None, 15))
     self.assert_finds_definition(u'Start with “this,”',
                                  def_finders.Ref('this', None, 12))
     self.assert_finds_definition(u'Start with “this;”',
                                  def_finders.Ref('this', None, 12))
     self.assert_finds_definition(u'Start with “this.”',
                                  def_finders.Ref('this', None, 12))
     self.assert_finds_definition(u'As do “subchildren”',
                                  def_finders.Ref('subchildren', None, 7))
 def test_find_success(self):
     """Verify that references can be found"""
     self.assert_finds_result(
         '(a) <E T="03">Definition</E>. Paragraph text', 'Definition',
         def_finders.Ref('definition', None, 4))
     self.assert_finds_result(
         '<E T="03">Another Phrase.</E>. Paragraph text', 'Definition',
         def_finders.Ref('another phrase', None, 0))
     # Comma isn't enough to split the definition
     self.assert_finds_result(
         '<E T="03">Officer, office.</E>. Paragraph text', 'Definition',
         def_finders.Ref('officer, office', None, 0))
     # "Or" should split the definition if the terms are simple
     self.assert_finds_result(
         '<E T="03">Frame or receiver.</E>. Paragraph text', 'Definition',
         def_finders.Ref('frame', None, 0),
         def_finders.Ref('receiver', None, 9))
     # "Or" should *not* split the definition if the terms are complex
     self.assert_finds_result(
         '<E T="03">Common or contract carrier</E>.', 'Definition',
         def_finders.Ref('common or contract carrier', None, 0))
 def assert_finds_result(self, tagged_text, term, start):
     """Check that the definition is found and matches the position"""
     self._assert_finds(tagged_text, def_finders.Ref(term, None, start))