mirror of
https://github.com/davidhalter/jedi.git
synced 2026-01-01 17:53:21 +08:00
Make infer public on classes
This commit is contained in:
@@ -207,9 +207,9 @@ def test_goto_assignments_follow_imports(Script):
|
||||
assert definition.name == 'p'
|
||||
result, = definition.goto_assignments()
|
||||
assert result.name == 'p'
|
||||
result, = definition._goto_definitions()
|
||||
result, = definition.infer()
|
||||
assert result.name == 'int'
|
||||
result, = result._goto_definitions()
|
||||
result, = result.infer()
|
||||
assert result.name == 'int'
|
||||
|
||||
definition, = script.goto_assignments()
|
||||
|
||||
@@ -29,7 +29,7 @@ def test_in_empty_space(Script):
|
||||
comps = Script(code, 3, 7).completions()
|
||||
self, = [c for c in comps if c.name == 'self']
|
||||
assert self.name == 'self'
|
||||
def_, = self._goto_definitions()
|
||||
def_, = self.infer()
|
||||
assert def_.name == 'X'
|
||||
|
||||
|
||||
|
||||
@@ -244,8 +244,8 @@ def test_completion_params():
|
||||
script = jedi.Interpreter('foo', [locals()])
|
||||
c, = script.completions()
|
||||
assert [p.name for p in c.params] == ['a', 'b']
|
||||
assert c.params[0]._goto_definitions() == []
|
||||
t, = c.params[1]._goto_definitions()
|
||||
assert c.params[0].infer() == []
|
||||
t, = c.params[1].infer()
|
||||
assert t.name == 'int'
|
||||
|
||||
|
||||
@@ -258,9 +258,9 @@ def test_completion_param_annotations():
|
||||
script = jedi.Interpreter('foo', [locals()])
|
||||
c, = script.completions()
|
||||
a, b, c = c.params
|
||||
assert a._goto_definitions() == []
|
||||
assert [d.name for d in b._goto_definitions()] == ['str']
|
||||
assert {d.name for d in c._goto_definitions()} == {'int', 'float'}
|
||||
assert a.infer() == []
|
||||
assert [d.name for d in b.infer()] == ['str']
|
||||
assert {d.name for d in c.infer()} == {'int', 'float'}
|
||||
|
||||
|
||||
def test_keyword_argument():
|
||||
@@ -340,7 +340,7 @@ def test_dir_magic_method():
|
||||
assert 'bar' in names
|
||||
|
||||
foo = [c for c in completions if c.name == 'foo'][0]
|
||||
assert foo._goto_definitions() == []
|
||||
assert foo.infer() == []
|
||||
|
||||
|
||||
def test_name_not_findable():
|
||||
|
||||
Reference in New Issue
Block a user