Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ------------- tasks/common_words.py ---------------
- def checkio(first, second):
- first = set(first.split(","))
- second = set(second.split(","))
- res = first.intersection(second)
- return ",".join(sorted(res))
- # ----------- tests/test_common_words.py -----------------
- import pytest
- from tasks.common_words import checkio
- @pytest.mark.parametrize(["item1", "item2", "res"], [
- ["hello,world", "hello,earth", "hello"],
- ["hello,world,hello", "hello,earth,hello", "hello"],
- ["one,two,three", "four,five,six", ""],
- ["one,two,three", "four,five,one,two,six,three", "one,three,two"],
- ])
- def test_common_words(item1, item2, res):
- assert checkio(item1, item2) == res
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement