def test_contains_one_designate_token(self): tokenized = self.list_of_tokens() self.assertTrue(diff.contains_one_designate_token(tokenized)) designate_token_2 = tokens.Verb(tokens.Verb.DESIGNATE, True) tokenized.append(designate_token_2) self.assertFalse(diff.contains_one_designate_token(tokenized))
def test_deal_with_subpart_adds(self): designate_token = tokens.Verb(tokens.Verb.DESIGNATE, True) token_list = self.paragraph_token_list() context = tokens.Context(["Subpart", "A"]) tokenized = [designate_token, token_list, context] toks, subpart_added = diff.deal_with_subpart_adds(tokenized) self.assertTrue(subpart_added) paragraph_found = False for t in toks: self.assertFalse(isinstance(t, tokens.Context)) if isinstance(t, tokens.Paragraph): self.assertEqual(t.label, ["Subpart", "A"]) paragraph_found = True self.assertTrue(diff.contains_one_tokenlist(toks)) self.assertTrue(diff.contains_one_designate_token(toks)) self.assertTrue(paragraph_found)
def test_deal_with_subpart_adds(self): designate_token = tokens.Verb(tokens.Verb.DESIGNATE, True) token_list = self.paragraph_token_list() context = tokens.Context(['Subpart', 'A']) tokenized = [designate_token, token_list, context] toks, subpart_added = diff.deal_with_subpart_adds(tokenized) self.assertTrue(subpart_added) paragraph_found = False for t in toks: self.assertFalse(isinstance(t, tokens.Context)) if isinstance(t, tokens.Paragraph): self.assertEqual(t.label, ['Subpart', 'A']) paragraph_found = True self.assertTrue(diff.contains_one_tokenlist(toks)) self.assertTrue(diff.contains_one_designate_token(toks)) self.assertTrue(paragraph_found)