def test_match_word(self): topic = PatternOneOrMoreWildCardNode("*") match = Match(Match.TOPIC, topic, "Hello") self.assertEquals(Match.TOPIC, match.match_type) self.assertEquals(topic, match.matched_node) self.assertEquals(["Hello"], match.matched_words) self.assertEquals("Match=(Topic) Node=(ONEORMORE [*]) Matched=(Hello)", match.to_string())
def test_match_word(self): topic = PatternOneOrMoreWildCardNode("*") match = Match(Match.TOPIC, topic, "Hello") self.assertEqual(Match.TOPIC, match.match_type) self.assertEqual(topic, match.matched_node) self.assertEqual(["Hello"], match.matched_words) self.assertEqual("Match=(Topic) Node=(ONEORMORE [*]) Matched=(Hello)", match.to_string(self._client_context.brain.tokenizer))
def test_match_word(self): topic = PatternOneOrMoreWildCardNode("*") match = Match(Match.TOPIC, topic, "Hello") self.assertEquals(Match.TOPIC, match.match_type) self.assertEquals(topic, match.matched_node) self.assertEquals(["Hello"], match.matched_words) self.assertEquals("Match=(Topic) Node=(ONEORMORE [*]) Matched=(Hello)", match.to_string(self._bot.brain.tokenizer))
def test_match_no_word(self): topic = PatternOneOrMoreWildCardNode("*") match = Match(Match.TOPIC, topic, None) self.assertEquals(Match.TOPIC, match.match_type) self.assertEquals(topic, match.matched_node) self.assertEquals([], match.matched_words) self.assertEquals("Match=(Topic) Node=(ONEORMORE [*]) Matched=()", match.to_string(self._bot.brain.tokenizer))
def test_match_multi_word(self): topic = PatternOneOrMoreWildCardNode("*") match = Match(Match.TOPIC, topic, None) match.add_word("Hello") match.add_word("World") self.assertEqual(["Hello", "World"], match.matched_words) self.assertEqual("Hello World", match.joined_words(self._client_context.brain.tokenizer)) self.assertEqual("Match=(Topic) Node=(ONEORMORE [*]) Matched=(Hello World)", match.to_string(self._client_context.brain.tokenizer))
def test_match_multi_word(self): topic = PatternOneOrMoreWildCardNode("*") match = Match(Match.TOPIC, topic, None) match.add_word("Hello") match.add_word("World") self.assertEquals(["Hello", "World"], match.matched_words) self.assertEquals("Hello World", match.joined_words(self._bot.brain.tokenizer)) self.assertEquals("Match=(Topic) Node=(ONEORMORE [*]) Matched=(Hello World)", match.to_string(self._bot.brain.tokenizer))