Sometimes you find yourself writing the same check over and over for multiple configurations. Instead, it would be convenient if we could write the test only once and provide the configurations in a declarative way.
That's exactly what @pytest.mark.parametrize allows us to do: to generate tests based on a template function and the various configurations that have to be provided.
For example, in our fizzbuzz software, we could have two isbuzz and isfizz checks that verify whether the provided number should lead us to print the "buzz" or "fizz" strings. Like always, we want to write a test that drives the implementation of those two little blocks of our software, and the tests might look like this:
def test_isfizz():
assert isfizz(1) is False
assert isfizz(3) is True
assert isfizz(4) is False
assert isfizz(6) is True
def test_isbuzz():
assert isbuzz(1) is False
assert isbuzz(3) is False
assert isbuzz(5)...