def test_get_word_lengths_with_negative_length(): """Ensure that we reject a word length that is negative.""" args = { "-w": ["-1"], } with pytest.raises(SystemExit): _get_word_lengths(args)
def test_get_word_lengths_with_non_integer(): """Ensure that we reject a word length that is not an integer.""" invalid_lengths = ["1.3", "lol"] for arg in invalid_lengths: args = { "-w": [arg], } with pytest.raises(SystemExit): _get_word_lengths(args)
def test_get_word_lengths(): """Ensure that we retrieve word lengths from the command-line arguments. """ args = { "-w": ["1", "2"], } assert _get_word_lengths(args) == [1, 2]