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

Method test_dir

Lib/test/test_genericalias.py:489–509  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

487 self.assertEqual(a.__parameters__, (T,))
488
489 def test_dir(self):
490 ga = list[int]
491 dir_of_gen_alias = set(dir(ga))
492 self.assertTrue(dir_of_gen_alias.issuperset(dir(list)))
493 for generic_alias_property in (
494 "__origin__", "__args__", "__parameters__",
495 "__unpacked__",
496 ):
497 with self.subTest(generic_alias_property=generic_alias_property):
498 self.assertIn(generic_alias_property, dir_of_gen_alias)
499 for blocked in (
500 "__bases__",
501 "__copy__",
502 "__deepcopy__",
503 ):
504 with self.subTest(blocked=blocked):
505 self.assertNotIn(blocked, dir_of_gen_alias)
506
507 for entry in dir_of_gen_alias:
508 with self.subTest(entry=entry):
509 getattr(ga, entry) # must not raise `AttributeError`
510
511 def test_weakref(self):
512 for t in self.generic_types:

Callers

nothing calls this directly

Calls 6

setFunction · 0.85
assertTrueMethod · 0.80
issupersetMethod · 0.80
assertInMethod · 0.80
assertNotInMethod · 0.80
subTestMethod · 0.45

Tested by

no test coverage detected