()
| 192 | |
| 193 | |
| 194 | def 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 | |
| 211 | def pytests() -> None: |