New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improved AppTest/ElementTree formatting #7658
Improved AppTest/ElementTree formatting #7658
Conversation
defaults: list[Any] = [None, "", False, [], set(), dict()] | ||
|
||
if dataclasses.is_dataclass(self): | ||
fields_vals = ( | ||
(f.name, getattr(self, f.name)) | ||
for f in dataclasses.fields(self) | ||
if f.repr | ||
and getattr(self, f.name) != f.default | ||
and getattr(self, f.name) not in defaults | ||
) | ||
else: | ||
fields_vals = ((f, v) for (f, v) in self.__dict__.items() if v not in defaults) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: might be worth adding a comment above defaults
mentioning that empty lists/sets/dicts compare to be equal -- I thought this wouldn't work when first reading through this before double checking that they do
@AnOctopus mind posting an output (copy/paste or screenshot) about how this looks? Exciting! 🚀 |
Describe your changes
Make AppTest and ElementTree reprs into an indented tree format, to aid debugging
GitHub Issue Link (if applicable)
Testing Plan
Manually tested, difficult to write reasonable tests for.
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.