Test & Code - Python Testing & Development

65: one assert per test

Informações:

Sinopsis

Is it ok to have more than one assert statement in a test? I've seen articles that say no, you should never have more than one assert. I've also seen some test code made almost unreadable due to trying to avoid more than one assert per test. Where did this recommendation even come from? What are the reasons? What are the downsides to both perspectives? That's what we're going to talk about today.Sponsored By: PyCharm Professional: Try PyCharm Pro for an extended 4 month trial before deciding which version you need. If you value your time, you owe it to yourself to try PyCharm. Promo Code: TESTANDCODE22Links: Twitter survey about multiple asserts/checks — Are multiple asserts/checks ok in an automated test? Multiple Asserts Are OK - Bill Wake pytest-check: A pytest plugin that allows multiple failures per test. If you like Test & Code, I think you'll also like Python People Python People is a new podcast about getting to know the people who make Python and our community awesome. Be sure to check out