Example #1
0
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)
Example #2
0
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)
Example #3
0
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]