MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_dir

Method test_dir

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected