The documentation for auto_exc says:
- the values for *cmp* and *hash* are ignored and the instances compare
and hash by the instance's ids (N.B. ``attrs`` will *not* remove
existing implementations of ``__hash__`` or the equality methods. It
just won't add own ones.),
However, the test for auto_exc says:
Classes with auto_exc=True have a Exception-style __str__, are neither
comparable nor hashable, and store the fields additionally in
self.args.
and tests:
with pytest.raises(TypeError):
hash(e)
The documentation and the code should be made consistent. I noticed this because unittest complained that the exception type was unhashable when thrown from a test and I see some references to logging expecting hashable exceptions, so the documented behavior is probably better than the implemented behavior.
The documentation for
auto_excsays:However, the test for
auto_excsays:and tests:
The documentation and the code should be made consistent. I noticed this because
unittestcomplained that the exception type was unhashable when thrown from a test and I see some references tologgingexpecting hashable exceptions, so the documented behavior is probably better than the implemented behavior.