Skip to content

Move old C API tests for floats to Lib/test/test_capi/ #111765

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

Closed
skirpichev opened this issue Nov 6, 2023 · 1 comment
Closed

Move old C API tests for floats to Lib/test/test_capi/ #111765

skirpichev opened this issue Nov 6, 2023 · 1 comment
Labels
tests Tests in the Lib/test dir topic-C-API type-feature A feature request or enhancement

Comments

@skirpichev
Copy link
Member

skirpichev commented Nov 6, 2023

After #111624, we have C API tests for PyFloat_* both in Lib/test/test_float.py (pack/unpack tests) and Lib/test/test_capi/test_float.py. I think we should move remaining tests to Lib/test/test_capi/.

Linked PRs

@skirpichev skirpichev added the type-feature A feature request or enhancement label Nov 6, 2023
skirpichev added a commit to skirpichev/cpython that referenced this issue Nov 6, 2023
@Eclips4 Eclips4 added tests Tests in the Lib/test dir topic-C-API labels Nov 6, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Nov 7, 2023
…float.py (pythonGH-111766)

(cherry picked from commit a077b2f)

Co-authored-by: Sergey B Kirpichev <[email protected]>
serhiy-storchaka pushed a commit that referenced this issue Nov 7, 2023
…_float.py (GH-111766) (GH-111818)

(cherry picked from commit a077b2f)

Co-authored-by: Sergey B Kirpichev <[email protected]>
hugovk pushed a commit to hugovk/cpython that referenced this issue Nov 8, 2023
@skirpichev
Copy link
Member Author

@serhiy-storchaka, I think this could be closed. The test_float.py still imports _testcapi:

@support.requires_IEEE_754
@unittest.skipIf(_testcapi is None, 'needs _testcapi')
def test_serialized_float_rounding(self):
FLT_MAX = _testcapi.FLT_MAX
self.assertEqual(struct.pack("<f", 3.40282356e38), struct.pack("<f", FLT_MAX))
self.assertEqual(struct.pack("<f", -3.40282356e38), struct.pack("<f", -FLT_MAX))

but this is rather a bug in sys.float_info.

aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir topic-C-API type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants