def test_consume_search_depth_exceeded(self): node = PatternZeroOrMoreWildCardNode("^") self.assertIsNotNone(node) match_context = MatchContext(max_search_depth=0, max_search_timeout=100) words = Sentence(self._client_context) result = node.consume(self._client_context, match_context, words, 0, Match.WORD, 1, parent=False) self.assertIsNone(result)
def test_consume_that(self): node = PatternZeroOrMoreWildCardNode("^") self.assertIsNotNone(node) node.add_that(PatternThatNode()) match_context = MatchContext(max_search_depth=100, max_search_timeout=100) words = Sentence(self._client_context, text="__THAT__") result = node.consume(self._client_context, match_context, words, 0, Match.WORD, 1, parent=False) self.assertIsNone(result)
def test_consume_with_priority_mismatch(self): node = PatternZeroOrMoreWildCardNode("^") priority = PatternPriorityWordNode("$TEST") node.add_child(priority) priority.add_template((PatternTemplateNode(TemplateWordNode("word")))) match_context = MatchContext(max_search_depth=100, max_search_timeout=100) words = Sentence(self._client_context, text="THIS $TEST2") result = node.consume(self._client_context, match_context, words, 0, Match.WORD, 1, parent=False) self.assertIsNone(result)