Merged
Conversation
MarcoGorelli
commented
Apr 9, 2026
|
|
||
| def approx(expected, rel=None, abs=None, nan_ok: bool = False) -> ApproxBase: | ||
| def approx( | ||
| expected: Any, |
Contributor
Author
There was a problem hiding this comment.
this one's extremely dynamic and can accept a huge variety of arguments, e.g.
pytest/testing/python/approx.py
Lines 1108 to 1131 in d1f93f0
Not sure how much it's worth it to list everything, so for now I'm just suggesting Any here and we can start making rel and abs more precise as well as making the function typed
Comment on lines
+619
to
+620
| assert approx(x, rel=0, abs=Decimal("5e-3")) == a | ||
| assert approx(x, rel=0, abs=Decimal("5e-7")) != a |
Contributor
Author
There was a problem hiding this comment.
I noticed that there wasn't any test for abs: Decimal, so I added this one
bluetech
approved these changes
Apr 10, 2026
Member
bluetech
left a comment
There was a problem hiding this comment.
The Any looks fine for now. Thanks!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.