resolved RESOLVED UNSUBMITTED PASS · None tool calls · 0 s · Textualize/rich
Fixed issue with custom classes (fixes #2875) ## Type of changes - [x] Bug fix - [ ] New feature - [ ] Documentation / docstrings - [ ] Tests - [ ] Other ## Checklist - [x] I've run the latest [black](https://github.com/psf/black) with default args on new code. - [x] I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate. - [x] I've added tests for new code. - [x] I accept that @willmcgugan may be pedantic in the code review. ## Description When `repr`ing classes that have overwritten `__eq__` as parameters, the check with `== Parameters.empty` can be `True`. Fixes #2875 with the suggested change. Also added the sample code as a test.
| # | Tool | Arguments | Result |
|---|---|---|---|
| No trace captured. | |||
--- a/rich/repr.py
+++ b/rich/repr.py
@@ -76,7 +76,7 @@ def auto_rich_repr(self: Type[T]) -> Result:
param.POSITIONAL_OR_KEYWORD,
param.KEYWORD_ONLY,
):
- if param.default == param.empty:
+ if param.default is param.empty:
yield getattr(self, param.name)
else:
yield param.name, getattr(self, param.name), param.default........ [100%] 8 passed in 0.10s