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