def main(word, filepath): valid_words = load_words_file(filepath) for anagram in find_anagrams(word, valid_words): print anagram
def test_load_words_file_not_exists(): with pytest.raises(IOError): list(load_words_file(MISSING_DATA_FILE))
def test_load_words_file_empty(): assert not list(load_words_file(EMPTY_DATA_FILE))
def test_load_words_file_rstrip(): words = ['care', 'acre', 'race', 'rack', 'racer'] assert words == list(load_words_file(RSTRIP_DATA_FILE))
def test_load_words_file_clean(): words = ['care', 'acre', 'race', 'rack', 'racer'] assert words == list(load_words_file(CLEAN_DATA_FILE))