Move get_node() to tree_node and replace all the custom classdefs/funcdefs.

This commit is contained in:
Dave Halter
2017-01-05 23:43:12 +01:00
parent b44f0aae5d
commit ae8e43d3c7
24 changed files with 90 additions and 99 deletions

View File

@@ -30,3 +30,16 @@ class Y(X):
#? []
myfoobar
# -----------------
# Inheritance
# -----------------
class Super():
enabled = True
if enabled:
yo_dude = 4
class Sub(Super):
#? ['yo_dude']
yo_dud

View File

@@ -291,16 +291,3 @@ elif 3 == flow_import.env:
#? int() str()
a
# -----------------
# Inheritance
# -----------------
class Super():
enabled = True
if enabled:
yo_dude = 4
class Sub(Super):
#? ['yo_dude']
yo_dud

View File

@@ -195,7 +195,7 @@ class IntegrationTestCase(object):
user_context = get_user_scope(module_context, (self.line_nr, 0))
if user_context.api_type == 'function':
user_context = user_context.get_function_execution()
element.parent = user_context.get_node()
element.parent = user_context.tree_node
results = evaluator.eval_element(user_context, element)
if not results:
raise Exception('Could not resolve %s on line %s'

View File

@@ -33,7 +33,7 @@ def test_fake_loading():
def test_fake_docstr():
assert compiled.create(_evaluator(), next).get_node().raw_doc == next.__doc__
assert compiled.create(_evaluator(), next).tree_node.raw_doc == next.__doc__
def test_parse_function_doc_illegal_docstr():

View File

@@ -257,7 +257,7 @@ def test_string_literals():
""")
script = jedi.Script(dedent(source))
script._get_module().module_node.end_pos == (6, 0)
script._get_module().tree_node.end_pos == (6, 0)
assert script.completions()
@@ -275,7 +275,7 @@ def test_decorator_string_issue():
s = jedi.Script(source)
assert s.completions()
assert s._get_module().module_node.get_code() == source
assert s._get_module().tree_node.get_code() == source
def test_round_trip():

View File

@@ -175,7 +175,7 @@ class TestRegression(TestCase):
completions = Script('').completions()
c = get_str_completion(completions)
str_context, = c._name.infer()
n = len(str_context.classdef.children[-1].children)
n = len(str_context.tree_node.children[-1].children)
if i == 0:
limit = n
else: