mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 22:44:27 +08:00
A lot more fixes - fix all evaluate integration tests.
This commit is contained in:
@@ -2,8 +2,8 @@ from textwrap import dedent
|
||||
|
||||
from jedi._compatibility import builtins, is_py3
|
||||
from jedi.parser import load_grammar
|
||||
from jedi.parser.tree import Function
|
||||
from jedi.evaluate import compiled, representation
|
||||
from jedi.evaluate import compiled, instance
|
||||
from jedi.evaluate.representation import FunctionContext
|
||||
from jedi.evaluate import Evaluator
|
||||
from jedi import Script
|
||||
|
||||
@@ -16,25 +16,24 @@ def test_simple():
|
||||
e = _evaluator()
|
||||
bltn = compiled.CompiledObject(e, builtins)
|
||||
obj = compiled.CompiledObject(e, '_str_', bltn)
|
||||
upper = e.find_types(obj, 'upper')
|
||||
assert len(upper) == 1
|
||||
objs = list(e.execute(list(upper)[0]))
|
||||
upper, = obj.py__getattribute__('upper')
|
||||
objs = list(upper.execute_evaluated())
|
||||
assert len(objs) == 1
|
||||
assert isinstance(objs[0], representation.Instance)
|
||||
assert isinstance(objs[0], instance.CompiledInstance)
|
||||
|
||||
|
||||
def test_fake_loading():
|
||||
e = _evaluator()
|
||||
assert isinstance(compiled.create(e, next), Function)
|
||||
assert isinstance(compiled.create(e, next), FunctionContext)
|
||||
|
||||
builtin = compiled.get_special_object(e, 'BUILTINS')
|
||||
string = builtin.get_subscope_by_name('str')
|
||||
string, = builtin.py__getattribute__('str')
|
||||
from_name = compiled._create_from_name(e, builtin, string, '__init__')
|
||||
assert isinstance(from_name, Function)
|
||||
assert isinstance(from_name, FunctionContext)
|
||||
|
||||
|
||||
def test_fake_docstr():
|
||||
assert compiled.create(_evaluator(), next).raw_doc == next.__doc__
|
||||
assert compiled.create(_evaluator(), next).get_node().raw_doc == next.__doc__
|
||||
|
||||
|
||||
def test_parse_function_doc_illegal_docstr():
|
||||
|
||||
Reference in New Issue
Block a user