Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
Closed
Labels
testsTests in the Lib/test dirTests in the Lib/test dirtype-featureA feature request or enhancementA feature request or enhancement
Description
Feature or enhancement
Proposal:
Clones of assertFloatsAreIdentical() are scattered across the CPython tests:
cpython/Lib/test/test_complex.py
Line 74 in d8f8243
| defassertFloatsAreIdentical(self, x, y): |
cpython/Lib/test/test_cmath.py
Line 68 in d8f8243
| defassertFloatIdentical(self, x, y): |
cpython/Lib/test/test_float.py
Line 1069 in d8f8243
| defidentical(self, x, y): |
cpython/Lib/test/test_capi/test_getargs.py
Line 440 in d8f8243
| defassertEqualWithSign(self, actual, expected): |
Maybe it's worth to have a dedicated check?
Or a special kwarg for the assertEqual method, to workaround NAN and -0.0 values for floats/complexes.
Edit:
Or at least some support from Lib/test/support... I was adding similar helper yet in another test file and that looks odd.
Numpy has numpy.testing.assert_equal():
>>> np.testing.assert_equal([0.0], [+0.0]) >>> np.testing.assert_equal([0.0], [-0.0]) Traceback (most recent call last): ... AssertionError: Items are not equal: item=0 ACTUAL: 0.0 DESIRED: -0.0 >>> np.testing.assert_equal([np.nan], [np.nan]) >>> np.testing.assert_equal([0.0], [np.nan]) Traceback (most recent call last): ... AssertionError: Items are not equal: item=0 ACTUAL: 0.0 DESIRED: nanHas this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Linked PRs
Metadata
Metadata
Assignees
Labels
testsTests in the Lib/test dirTests in the Lib/test dirtype-featureA feature request or enhancementA feature request or enhancement