Closed
Description
Right now the only test we have for dir()
on _GenericAlias
is
def test_genericalias_dir(self):
class Foo(Generic[T]):
def bar(self):
pass
baz = 3
# The class attributes of the original class should be visible even
# in dir() of the GenericAlias. See bpo-45755.
self.assertIn('bar', dir(Foo[int]))
self.assertIn('baz', dir(Foo[int]))
And here's how it is defined:
Lines 1323 to 1325 in c330b4a
We clearly need more tests:
- That dunder methods are not included
- What
_GenericAlias
API we expose (at least parts that we consider user-visible, like__args__
and__parameters__
and__origin__
) _GenericAlias
has subclasses, they are also not tested
I will send a PR for this :)
Linked PRs
Metadata
Metadata
Assignees
Labels
Tests in the Lib/test dirTests in the Lib/test dirAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error