ppe2/tests/tests_codewars/test_most_words_used.py

28 lines
1.0 KiB
Python

from src.codewars.kata_most_words_used import top_3_words
import pytest
@pytest.mark.parametrize(
("input", "expected"),
[
("a a a b c c d d d d e e e e e", ["e", "d", "a"]),
("e e e e DDD ddd DdD: ddd ddd aa aA Aa, bb cc cC e e e", ["e", "ddd", "aa"]),
(" //wont won't won't ", ["won't", "wont"]),
(" , e .. ", ["e"]),
(" ... ", []),
(" ' ", []),
(" ''' ", []),
(
"""In a village of La Mancha, the name of which I have no desire to call to
mind, there lived not long since one of those gentlemen that keep a lance
in the lance-rack, an old buckler, a lean hack, and a greyhound for
coursing. An olla of rather more beef than mutton, a salad on most
nights, scraps on Saturdays, lentils on Fridays, and a pigeon or so extra
on Sundays, made away with three-quarters of his income.""",
["a", "of", "on"],
),
],
)
def test_top_3_words(input, expected):
assert top_3_words(input) == expected