mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 06:44:46 +08:00
@@ -349,8 +349,8 @@ class SubModule(Scope, Module):
|
|||||||
:param name: The name of the global.
|
:param name: The name of the global.
|
||||||
:type name: Name
|
:type name: Name
|
||||||
"""
|
"""
|
||||||
self.global_vars.append(name)
|
|
||||||
# set no parent here, because globals are not defined in this scope.
|
# set no parent here, because globals are not defined in this scope.
|
||||||
|
self.global_vars.append(name)
|
||||||
|
|
||||||
def get_set_vars(self):
|
def get_set_vars(self):
|
||||||
n = super(SubModule, self).get_set_vars()
|
n = super(SubModule, self).get_set_vars()
|
||||||
|
|||||||
@@ -364,6 +364,21 @@ class TestRegression(TestBase):
|
|||||||
words = [c.word for c in self.complete(s)]
|
words = [c.word for c in self.complete(s)]
|
||||||
assert 'start' in words
|
assert 'start' in words
|
||||||
|
|
||||||
|
def test_no_statement_parent(self):
|
||||||
|
source = textwrap.dedent("""
|
||||||
|
def f():
|
||||||
|
pass
|
||||||
|
|
||||||
|
class C:
|
||||||
|
pass
|
||||||
|
|
||||||
|
variable = f or C""")
|
||||||
|
lines = source.splitlines()
|
||||||
|
defs = self.definition(source, (len(lines), 3))
|
||||||
|
defs = sorted(defs, key=lambda d: d.line)
|
||||||
|
self.assertEqual([d.description for d in defs],
|
||||||
|
['def f', 'class C'])
|
||||||
|
|
||||||
|
|
||||||
class TestDocstring(TestBase):
|
class TestDocstring(TestBase):
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user