Blog Posts by Date | tag: 'dataclasses'
Better parameterized pytests with dataclasses
September 14, 2023 / 23 min read / 5,757 , 7 , 0
Parameterization is a powerful tool in pytest (the most popular Python testing framework). It allows us to write a single, simple test that can dynamically expand to become many similar tests with minor input differences. In this blog post, I will describe how to write parameterized pytests and why they are such a powerful tool. And then, I'll show you how to re-write parameterized tests more effectively using dataclasses.