Skip to content

Commit 0a3fb93

Browse files
committed
gh-116417: Move limited C API abstract.c tests to _testlimitedcapi
Split abstract.c and float.c tests of _testcapi into two parts: limited C API tests in _testlimitedcapi and non-limited C API tests in _testcapi.
1 parent a3cf0fa commit 0a3fb93

File tree

11 files changed

+763
-711
lines changed

11 files changed

+763
-711
lines changed

Lib/test/test_capi/test_abstract.py

Lines changed: 57 additions & 56 deletions
Large diffs are not rendered by default.

Lib/test/test_capi/test_float.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from test.support import import_helper
1010

1111
_testcapi = import_helper.import_module('_testcapi')
12+
_testlimitedcapi = import_helper.import_module('_testlimitedcapi')
1213

1314
NULL = None
1415

@@ -29,7 +30,7 @@
2930
class CAPIFloatTest(unittest.TestCase):
3031
def test_check(self):
3132
# Test PyFloat_Check()
32-
check = _testcapi.float_check
33+
check = _testlimitedcapi.float_check
3334

3435
self.assertTrue(check(4.25))
3536
self.assertTrue(check(FloatSubclass(4.25)))
@@ -41,7 +42,7 @@ def test_check(self):
4142

4243
def test_checkexact(self):
4344
# Test PyFloat_CheckExact()
44-
checkexact = _testcapi.float_checkexact
45+
checkexact = _testlimitedcapi.float_checkexact
4546

4647
self.assertTrue(checkexact(4.25))
4748
self.assertFalse(checkexact(FloatSubclass(4.25)))
@@ -53,7 +54,7 @@ def test_checkexact(self):
5354

5455
def test_fromstring(self):
5556
# Test PyFloat_FromString()
56-
fromstring = _testcapi.float_fromstring
57+
fromstring = _testlimitedcapi.float_fromstring
5758

5859
self.assertEqual(fromstring("4.25"), 4.25)
5960
self.assertEqual(fromstring(b"4.25"), 4.25)
@@ -72,13 +73,13 @@ def test_fromstring(self):
7273

7374
def test_fromdouble(self):
7475
# Test PyFloat_FromDouble()
75-
fromdouble = _testcapi.float_fromdouble
76+
fromdouble = _testlimitedcapi.float_fromdouble
7677

7778
self.assertEqual(fromdouble(4.25), 4.25)
7879

7980
def test_asdouble(self):
8081
# Test PyFloat_AsDouble()
81-
asdouble = _testcapi.float_asdouble
82+
asdouble = _testlimitedcapi.float_asdouble
8283

8384
class BadFloat3:
8485
def __float__(self):
@@ -109,19 +110,19 @@ def __float__(self):
109110

110111
def test_getinfo(self):
111112
# Test PyFloat_GetInfo()
112-
getinfo = _testcapi.float_getinfo
113+
getinfo = _testlimitedcapi.float_getinfo
113114

114115
self.assertEqual(getinfo(), sys.float_info)
115116

116117
def test_getmax(self):
117118
# Test PyFloat_GetMax()
118-
getmax = _testcapi.float_getmax
119+
getmax = _testlimitedcapi.float_getmax
119120

120121
self.assertEqual(getmax(), sys.float_info.max)
121122

122123
def test_getmin(self):
123124
# Test PyFloat_GetMax()
124-
getmin = _testcapi.float_getmin
125+
getmin = _testlimitedcapi.float_getmin
125126

126127
self.assertEqual(getmin(), sys.float_info.min)
127128

Modules/Setup.stdlib.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@
163163
@MODULE__TESTBUFFER_TRUE@_testbuffer _testbuffer.c
164164
@MODULE__TESTINTERNALCAPI_TRUE@_testinternalcapi _testinternalcapi.c _testinternalcapi/test_lock.c _testinternalcapi/pytime.c _testinternalcapi/set.c _testinternalcapi/test_critical_sections.c
165165
@MODULE__TESTCAPI_TRUE@_testcapi _testcapimodule.c _testcapi/vectorcall.c _testcapi/heaptype.c _testcapi/abstract.c _testcapi/unicode.c _testcapi/dict.c _testcapi/set.c _testcapi/list.c _testcapi/tuple.c _testcapi/getargs.c _testcapi/datetime.c _testcapi/docstring.c _testcapi/mem.c _testcapi/watchers.c _testcapi/long.c _testcapi/float.c _testcapi/complex.c _testcapi/numbers.c _testcapi/structmember.c _testcapi/exceptions.c _testcapi/code.c _testcapi/buffer.c _testcapi/pyatomic.c _testcapi/file.c _testcapi/codec.c _testcapi/immortal.c _testcapi/gc.c _testcapi/hash.c _testcapi/time.c
166-
@MODULE__TESTLIMITEDCAPI_TRUE@_testlimitedcapi _testlimitedcapi.c _testlimitedcapi/bytearray.c _testlimitedcapi/bytes.c _testlimitedcapi/heaptype_relative.c _testlimitedcapi/list.c _testlimitedcapi/pyos.c _testlimitedcapi/set.c _testlimitedcapi/sys.c _testlimitedcapi/vectorcall_limited.c
166+
@MODULE__TESTLIMITEDCAPI_TRUE@_testlimitedcapi _testlimitedcapi.c _testlimitedcapi/abstract.c _testlimitedcapi/bytearray.c _testlimitedcapi/bytes.c _testlimitedcapi/float.c _testlimitedcapi/heaptype_relative.c _testlimitedcapi/list.c _testlimitedcapi/pyos.c _testlimitedcapi/set.c _testlimitedcapi/sys.c _testlimitedcapi/vectorcall_limited.c
167167
@MODULE__TESTCLINIC_TRUE@_testclinic _testclinic.c
168168
@MODULE__TESTCLINIC_LIMITED_TRUE@_testclinic_limited _testclinic_limited.c
169169

0 commit comments

Comments
 (0)