getsentry / sentry-python

The official Python SDK for Sentry.io
https://sentry.io/for/python/
MIT License
1.88k stars 496 forks source link

(tests) Move away from `ApproxDict` #3380

Open szokeasaurusrex opened 2 months ago

szokeasaurusrex commented 2 months ago

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 commented 2 months ago

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.