1
0
forked from VimPlug/jedi

Fix some bugs of the last few commits

This commit is contained in:
Dave Halter
2018-12-22 22:08:54 +01:00
parent 1065768c77
commit 24174632d4
4 changed files with 13 additions and 6 deletions

View File

@@ -308,6 +308,10 @@ class TreeArgumentsWrapper(_AbstractArgumentsMixin):
def __init__(self, arguments): def __init__(self, arguments):
self._wrapped_arguments = arguments self._wrapped_arguments = arguments
@property
def context(self):
return self._wrapped_arguments.context
@property @property
def argument_node(self): def argument_node(self):
return self._wrapped_arguments.argument_node return self._wrapped_arguments.argument_node

View File

@@ -276,7 +276,7 @@ def builtins_reversed(sequences, obj, arguments):
cn = None cn = None
if isinstance(lazy_context, LazyTreeContext): if isinstance(lazy_context, LazyTreeContext):
# TODO access private # TODO access private
cn = ContextualizedNode(lazy_context._context, lazy_context.data) cn = ContextualizedNode(lazy_context.context, lazy_context.data)
ordered = list(sequences.iterate(cn)) ordered = list(sequences.iterate(cn))
# Repack iterator values and then run it the normal way. This is # Repack iterator values and then run it the normal way. This is
@@ -321,7 +321,7 @@ def builtins_isinstance(objects, types, arguments, evaluator):
message = 'TypeError: isinstance() arg 2 must be a ' \ message = 'TypeError: isinstance() arg 2 must be a ' \
'class, type, or tuple of classes and types, ' \ 'class, type, or tuple of classes and types, ' \
'not %s.' % cls_or_tup 'not %s.' % cls_or_tup
analysis.add(lazy_context._context, 'type-error-isinstance', node, message) analysis.add(lazy_context.context, 'type-error-isinstance', node, message)
return ContextSet( return ContextSet(
compiled.builtin_from_name(evaluator, force_unicode(str(b))) compiled.builtin_from_name(evaluator, force_unicode(str(b)))

View File

@@ -6,8 +6,9 @@
1 - '1' 1 - '1'
-1 - - 1 -1 - - 1
-1 - int() # TODO uncomment
int() - float() #-1 - int()
#int() - float()
float() - 3.0 float() - 3.0
a = 3 a = 3

View File

@@ -12,6 +12,8 @@ from jedi.evaluate import compiled
from jedi.evaluate import imports from jedi.evaluate import imports
from ..helpers import cwd_at from ..helpers import cwd_at
THIS_DIR = os.path.dirname(__file__)
@pytest.mark.skipif('sys.version_info < (3,3)') @pytest.mark.skipif('sys.version_info < (3,3)')
def test_find_module_py33(): def test_find_module_py33():
@@ -256,8 +258,8 @@ def test_compiled_import_none(monkeypatch, Script):
@pytest.mark.parametrize( @pytest.mark.parametrize(
('path', 'goal'), [ ('path', 'goal'), [
('test_evaluate/test_docstring.py', ('ok', 'lala', 'test_imports')), (os.path.join(THIS_DIR, 'test_docstring.py'), ('ok', 'lala', 'test_imports')),
('test_evaluate/__init__.py', ('ok', 'lala', 'x', 'test_imports')), (os.path.join(THIS_DIR, '__init__.py'), ('ok', 'lala', 'x', 'test_imports')),
] ]
) )
def test_get_modules_containing_name(evaluator, path, goal): def test_get_modules_containing_name(evaluator, path, goal):