failed NO_PATCH NO_PATCH UNSUBMITTED empty_patch(None) · 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. | |||
...F
=================================== FAILURES ===================================
_____________________________ test_rich_repr_auto ______________________________
def test_rich_repr_auto() -> None:
assert repr(Egg("hello", egg=2)) == "Egg('hello', egg=2)"
stupid_class = StupidClass(9)
not_stupid = NotStupid()
> assert (
repr(Bird("penguin", ["fish"], another=stupid_class, extinct=not_stupid))
== f"Bird('penguin', ['fish'], another={repr(stupid_class)}, extinct={repr(not_stupid)})"
)
E assert "Bird('pengui...0x105e6ce10>)" == "Bird('pengui...0x105e6ce10>)"
E
E - Bird('penguin', ['fish'], another=<tests.test_repr.StupidClass object at 0x105e6c690>, extinct=<tests.test_repr.NotStupid object at 0x105e6ce10>)
E ? --------
E + Bird('penguin', ['fish'], <tests.test_repr.StupidClass object at 0x105e6c690>, extinct=<tests.test_repr.NotStupid object at 0x105e6ce10>)
tests/test_repr.py:129: AssertionError
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
1 failed, 3 passed in 0.14s