Fix test by radarhere · Pull Request #8996 · python-pillow/Pillow

def test_old_version(deprecated: str, plural: bool, expected: str) -> None:
expected = r""
with pytest.raises(RuntimeError, match=expected):
_deprecate.deprecate(deprecated, 1, plural=plural)

Somehow, this test managed to immediately discard the expected argument and set it to an empty string instead.

The code originated in #6184