mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-16 02:27:06 +08:00
Add er.Generator.__getattr__
This commit is contained in:
@@ -773,6 +773,9 @@ class Generator(use_metaclass(cache.CachedMetaClass, pr.Base)):
|
|||||||
def parent(self):
|
def parent(self):
|
||||||
return self.func.parent
|
return self.func.parent
|
||||||
|
|
||||||
|
def __getattr__(self, name):
|
||||||
|
return getattr(self.func, name)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<%s of %s>" % (type(self).__name__, self.func)
|
return "<%s of %s>" % (type(self).__name__, self.func)
|
||||||
|
|
||||||
|
|||||||
@@ -50,4 +50,4 @@ def make_definitions():
|
|||||||
@pytest.mark.parametrize('definition', make_definitions())
|
@pytest.mark.parametrize('definition', make_definitions())
|
||||||
def test_basedefinition_type(definition):
|
def test_basedefinition_type(definition):
|
||||||
assert definition.type in ('module', 'class', 'instance', 'function',
|
assert definition.type in ('module', 'class', 'instance', 'function',
|
||||||
'statement', 'import', 'param')
|
'generator', 'statement', 'import', 'param')
|
||||||
|
|||||||
Reference in New Issue
Block a user