@parametrize_cases(
Case("handle null", age=None, x="foobar"),
Case("don't allow under 13s", age=11, x="foobar"),
Case("or old age pension", age=77, x="wobble"),
... # as many as you want
)
def test_lots_of_ways_to_fail(age, x):
with pytest.raises(ValueError):
function_under_test(age, x)
https://github.com/ckp95/pytest-parametrize-cases