def test_get_words_error():
    """Ensure that we throw an exception on encountering an error while trying
    to read the words from the dictionary file.
    """
    with pytest.raises(SystemExit):
        args = {
            "-d": "doesn't exist.txt",
        }
        _get_words(args)
def test_get_words():
    """Ensure that we read the word list from a file."""
    word_file_contents = """
foo
bar
"""
    with tempfile.NamedTemporaryFile("w+") as f:
        f.write(word_file_contents)
        f.seek(0)

        args = {
            "-d": f.name,
        }
        assert _get_words(args) == {"foo", "bar"}