gh-107178: Add the C API tests for the Abstract Objects Layer (GH-107179)

Cover all the Mapping Protocol, almost all the Sequence Protocol
(except PySequence_Fast) and a part of the Object Protocol.

Move existing tests to Lib/test/test_capi/test_abstract.py and
Modules/_testcapi/abstract.c.

Add also tests for PyDict C API.
This commit is contained in:
Serhiy Storchaka 2023-08-07 18:51:43 +03:00 committed by GitHub
parent 8579327879
commit 16c9415fba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 2174 additions and 297 deletions

View file

@ -1354,7 +1354,7 @@ class ByteArrayTest(BaseBytesTest, unittest.TestCase):
except ValueError:
pass
try:
setitem(b, 0, None)
setitem(b, 0, object())
self.fail("Didn't raise TypeError")
except TypeError:
pass