Skip to content

Commit a665b2a

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. Update test_bytes.
1 parent a3cf0fa commit a665b2a

File tree

12 files changed

+770
-718
lines changed

12 files changed

+770
-718
lines changed

Lib/test/test_bytes.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -991,13 +991,13 @@ def test_translate(self):
991991
self.assertEqual(c, b'hllo')
992992

993993
def test_sq_item(self):
994-
_testcapi = import_helper.import_module('_testcapi')
994+
_testlimitedcapi = import_helper.import_module('_testlimitedcapi')
995995
obj = self.type2test((42,))
996996
with self.assertRaises(IndexError):
997-
_testcapi.sequence_getitem(obj, -2)
997+
_testlimitedcapi.sequence_getitem(obj, -2)
998998
with self.assertRaises(IndexError):
999-
_testcapi.sequence_getitem(obj, 1)
1000-
self.assertEqual(_testcapi.sequence_getitem(obj, 0), 42)
999+
_testlimitedcapi.sequence_getitem(obj, 1)
1000+
self.assertEqual(_testlimitedcapi.sequence_getitem(obj, 0), 42)
10011001

10021002

10031003
class BytesTest(BaseBytesTest, unittest.TestCase):
@@ -1256,7 +1256,7 @@ class SubBytes(bytes):
12561256
class ByteArrayTest(BaseBytesTest, unittest.TestCase):
12571257
type2test = bytearray
12581258

1259-
_testcapi = import_helper.import_module('_testcapi')
1259+
_testlimitedcapi = import_helper.import_module('_testlimitedcapi')
12601260

12611261
def test_getitem_error(self):
12621262
b = bytearray(b'python')
@@ -1354,7 +1354,7 @@ def setitem_as_mapping(b, i, val):
13541354
b[i] = val
13551355

13561356
def setitem_as_sequence(b, i, val):
1357-
self._testcapi.sequence_setitem(b, i, val)
1357+
self._testlimitedcapi.sequence_setitem(b, i, val)
13581358

13591359
def do_tests(setitem):
13601360
b = bytearray([1, 2, 3])
@@ -1401,7 +1401,7 @@ def del_as_mapping(b, i):
14011401
del b[i]
14021402

14031403
def del_as_sequence(b, i):
1404-
self._testcapi.sequence_delitem(b, i)
1404+
self._testlimitedcapi.sequence_delitem(b, i)
14051405

14061406
def do_tests(delete):
14071407
b = bytearray(range(10))

0 commit comments

Comments
 (0)