Esempio n. 1
0
 def test_match_no_word(self):
     topic = PatternOneOrMoreWildCardNode("*")
     match = Match(Match.TOPIC, topic, None)
     self.assertEqual(Match.TOPIC, match.matched_node_type)
     self.assertEqual(Match.TOPIC, match.matched_node_type)
     self.assertEqual([], match.matched_node_words)
     self.assertEqual("Match=(Topic) Node=(ONEORMORE [*]) Matched=()",
                      match.to_string(self._client_context))
Esempio n. 2
0
    def test_match_word(self):
        topic = PatternOneOrMoreWildCardNode("*")
        match = Match(Match.TOPIC, topic, "Hello")

        self.assertEqual(Match.TOPIC, match.matched_node_type)
        self.assertTrue(match.matched_node_multi_word)
        self.assertTrue(match.matched_node_wildcard)
        self.assertEqual("ONEORMORE [*]", match.matched_node_str)
        self.assertEqual("Match=(Topic) Node=(ONEORMORE [*]) Matched=(Hello)",
                         match.to_string(self._client_context))
        self.assertEqual(["Hello"], match.matched_node_words)