class PasswordHash:
def __str__(self):
raise RuntimeError('This hash cannot be used in a string context')
$ ruff check --isolated --select PLE0307 --preview --no-cache --output-format concise rufftest/ruff_sample.py
rufftest/ruff_sample.py:2:9: PLE0307 `__str__` does not return `str`
It works as expected when raising NotImplementedError, but IMHO any raise-only body should avoid triggering this.