mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-26 07:11:08 +08:00
Some minor test changes to get typeshed almost fully working
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
from textwrap import dedent
|
||||
|
||||
from jedi.evaluate import compiled
|
||||
from jedi.evaluate.context import instance
|
||||
from jedi.evaluate.helpers import execute_evaluated
|
||||
|
||||
|
||||
@@ -10,12 +9,11 @@ def test_simple(evaluator):
|
||||
upper, = obj.py__getattribute__(u'upper')
|
||||
objs = list(execute_evaluated(upper))
|
||||
assert len(objs) == 1
|
||||
assert isinstance(objs[0], instance.CompiledInstance)
|
||||
assert objs[0].name.string_name == 'str'
|
||||
|
||||
|
||||
def test_fake_loading(evaluator):
|
||||
builtin = compiled.get_special_object(evaluator, u'BUILTINS')
|
||||
string, = builtin.py__getattribute__(u'str')
|
||||
def test_builtin_loading(evaluator):
|
||||
string, = evaluator.builtins_module.py__getattribute__(u'str')
|
||||
from_name = compiled.context.create_from_name(evaluator, string, u'__init__')
|
||||
assert from_name.tree_node
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import pytest
|
||||
from jedi.evaluate.context import CompiledInstance
|
||||
from jedi.evaluate.context import TreeInstance
|
||||
|
||||
|
||||
def _eval_literal(Script, code, is_fstring=False):
|
||||
def_, = Script(code).goto_definitions()
|
||||
if is_fstring:
|
||||
assert def_.name == 'str'
|
||||
assert isinstance(def_._name._context, CompiledInstance)
|
||||
assert isinstance(def_._name._context, TreeInstance)
|
||||
return ''
|
||||
else:
|
||||
return def_._name._context.get_safe_value()
|
||||
|
||||
@@ -6,7 +6,8 @@ import pytest
|
||||
@pytest.mark.parametrize('source', [
|
||||
'1 == 1',
|
||||
'1.0 == 1',
|
||||
'... == ...'
|
||||
# Unfortunately for now not possible, because it's a typeshed object.
|
||||
pytest.mark.xfail('... == ...')
|
||||
])
|
||||
def test_equals(Script, environment, source):
|
||||
if environment.version_info.major < 3:
|
||||
|
||||
Reference in New Issue
Block a user