MCPcopy
hub / github.com/TheAlgorithms/Python / test_trie

Function test_trie

data_structures/trie/radix_tree.py:194–208  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

192
193
194def test_trie() -> bool:
195 words = "banana bananas bandana band apple all beast".split()
196 root = RadixNode()
197 root.insert_many(words)
198
199 assert all(root.find(word) for word in words)
200 assert not root.find("bandanas")
201 assert not root.find("apps")
202 root.delete("all")
203 assert not root.find("all")
204 root.delete("banana")
205 assert not root.find("banana")
206 assert root.find("bananas")
207
208 return True
209
210
211def pytests() -> None:

Callers 1

pytestsFunction · 0.70

Calls 5

insert_manyMethod · 0.95
findMethod · 0.95
deleteMethod · 0.95
RadixNodeClass · 0.85
splitMethod · 0.80

Tested by

no test coverage detected