Sometimes it’s useful to provide different input data and test different exceptions being raised. Not every exception deserves its own unit test, though. In such cases, I tend to combine PyTest’s parametrize marker with Python’s contextlib.nullcontext builtin.