def test_is_word(): print("Testing is_word") words = ["are", "and", "a", "an", "be", "bee", "Be"] t = test_add_words(words) for word in ["hippie", "are", "a", "bee", "Be", "an", "b", "ar"]: if ( is_word(word, t) != (word in words) ): print("\tfailed on: ", word) print("Finished testing is_word")
# CS122: Auto-completing keyboard using Tries # # Tests for your trie implementation # # YOUR NAME HERE from trie_dict import create_trie_node, add_word, is_word, num_completions, get_completions t = create_trie_node() add_word("a", t) add_word("an", t) add_word("and", t) add_word("are", t) add_word("bee", t) # Write your tests here # Example of an assertion. If "bee" was not inserted # correctly in the trie, the following statement will # cause the program to exit with an error message. assert is_word("bee", t)
from trie_dict import create_trie_node, add_word, is_word, num_completions, get_completions t = create_trie_node() add_word("a", t) add_word("an", t) add_word("and", t) add_word("are", t) add_word("bee", t) # Write your tests here # Example of an assertion. If "bee" was not inserted # correctly in the trie, the following statement will # cause the program to exit with an error message. assert is_word("bee", t)