MCPcopy Index your code
hub / github.com/python/cpython / test_c_class

Method test_c_class

Lib/test/test_genericclass.py:280–293  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

278class CAPITest(unittest.TestCase):
279
280 def test_c_class(self):
281 _testcapi = import_module("_testcapi")
282 Generic = _testcapi.Generic
283 GenericAlias = _testcapi.GenericAlias
284 self.assertIsInstance(Generic.__class_getitem__(int), GenericAlias)
285
286 IntGeneric = Generic[int]
287 self.assertIs(type(IntGeneric), GenericAlias)
288 self.assertEqual(IntGeneric.__mro_entries__(()), (int,))
289 class C(IntGeneric):
290 pass
291 self.assertEqual(C.__bases__, (int,))
292 self.assertEqual(C.__orig_bases__, (IntGeneric,))
293 self.assertEqual(C.__mro__, (C, int, object))
294
295
296if __name__ == "__main__":

Callers

nothing calls this directly

Calls 6

import_moduleFunction · 0.90
assertIsInstanceMethod · 0.80
__class_getitem__Method · 0.45
assertIsMethod · 0.45
assertEqualMethod · 0.45
__mro_entries__Method · 0.45

Tested by

no test coverage detected