Skip to content
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

gh-116417: Move limited C API abstract.c tests to _testlimitedcapi #116986

Merged
merged 2 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Lib/test/test_bytes.py
Original file line number Diff line number Diff line change
Expand Up @@ -991,13 +991,13 @@ def test_translate(self):
self.assertEqual(c, b'hllo')

def test_sq_item(self):
_testcapi = import_helper.import_module('_testcapi')
_testlimitedcapi = import_helper.import_module('_testlimitedcapi')
obj = self.type2test((42,))
with self.assertRaises(IndexError):
_testcapi.sequence_getitem(obj, -2)
_testlimitedcapi.sequence_getitem(obj, -2)
with self.assertRaises(IndexError):
_testcapi.sequence_getitem(obj, 1)
self.assertEqual(_testcapi.sequence_getitem(obj, 0), 42)
_testlimitedcapi.sequence_getitem(obj, 1)
self.assertEqual(_testlimitedcapi.sequence_getitem(obj, 0), 42)


class BytesTest(BaseBytesTest, unittest.TestCase):
Expand Down Expand Up @@ -1256,7 +1256,7 @@ class SubBytes(bytes):
class ByteArrayTest(BaseBytesTest, unittest.TestCase):
type2test = bytearray

_testcapi = import_helper.import_module('_testcapi')
_testlimitedcapi = import_helper.import_module('_testlimitedcapi')

def test_getitem_error(self):
b = bytearray(b'python')
Expand Down Expand Up @@ -1354,7 +1354,7 @@ def setitem_as_mapping(b, i, val):
b[i] = val

def setitem_as_sequence(b, i, val):
self._testcapi.sequence_setitem(b, i, val)
self._testlimitedcapi.sequence_setitem(b, i, val)

def do_tests(setitem):
b = bytearray([1, 2, 3])
Expand Down Expand Up @@ -1401,7 +1401,7 @@ def del_as_mapping(b, i):
del b[i]

def del_as_sequence(b, i):
self._testcapi.sequence_delitem(b, i)
self._testlimitedcapi.sequence_delitem(b, i)

def do_tests(delete):
b = bytearray(range(10))
Expand Down Expand Up @@ -1810,7 +1810,7 @@ def __index__(self):
with self.subTest("tp_as_sequence"):
b = bytearray(b'Now you see me...')
with self.assertRaises(IndexError):
self._testcapi.sequence_setitem(b, 0, Boom())
self._testlimitedcapi.sequence_setitem(b, 0, Boom())


class AssortedBytesTest(unittest.TestCase):
Expand Down
Loading
Loading