Skip to content
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

(tests) Move away from ApproxDict #3380

Open
szokeasaurusrex opened this issue Jul 30, 2024 · 1 comment · May be fixed by #3388
Open

(tests) Move away from ApproxDict #3380

szokeasaurusrex opened this issue Jul 30, 2024 · 1 comment · May be fixed by #3388

Comments

@szokeasaurusrex
Copy link
Member

conftest.py defines an ApproxDict, which is a subclass of dict, whose equality method has been overridden such that, if a and b are dictionaries, then a == ApproxDict(b) will have the same truth value as a.items() >= b.items() (i.e. a is equal to ApproxDict(b) if a's key-value pairs are a superset of b's key-value pairs).

Since a.items() >= b.items() is a much clearer assertion than a == ApproxDict(b), let's replace usages of ApproxDict in our test suite with the more explicit assertion.

czyber added a commit to czyber/sentry-python that referenced this issue Aug 1, 2024
This commit removes `ApproxDict` in favor of a more explicit assertion style.

Closes getsentry#3380
@czyber czyber linked a pull request Aug 1, 2024 that will close this issue
@czyber
Copy link
Contributor

czyber commented Aug 1, 2024

Hey @szokeasaurusrex , i started working on this if you dont mind. Still need to clean up some assertions which weren't picked up by the regex I used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

2 participants