def test_normal(self): text = "agtgggg" patterns = ["ag"] trie = trie_builder.PrefixTrieConstruction(patterns) val = trie_builder.is_prefix(text, trie) self.assertTrue(val)
def test_false(self): text = "ccca" patterns = ["ca", "gt"] trie = trie_builder.PrefixTrieConstruction(patterns) val = trie_builder.is_prefix(text, trie) self.assertFalse(val)
def test_wrong_text(self): text = None patterns = ["a"] trie = trie_builder.PrefixTrieConstruction(patterns) with self.assertRaises(TypeError): trie_builder.is_prefix(text, trie)