pytest: clean params
Testing your code is a good idea because it usually leads to great improvements. There's many libraries in python that will help with testing but a favourable on called pytest. In this series of videos we demonstrate how the use it.
test_blackjack.py file looks like this;
import pytest from blackjack import card_score @pytest.mark.parametrize("cards,score", [('JK', 20), ('KKK', 0), ('AA', 12), ('AK', 21)]) def test_simple_usecase(cards, score): assert card_score(cards) == score
We hope you agree it is better this way.
Feedback? See an issue? Something unclear? Feel free to mention it here.
If you want to be kept up to date, consider signing up for the newsletter.