mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 14:34:31 +08:00
Improve interpreter tests.
This commit is contained in:
@@ -38,6 +38,9 @@ class MixedObject(object):
|
|||||||
assert search_global is False
|
assert search_global is False
|
||||||
return [LazyMixedNamesDict(self._evaluator, self, is_instance=False)]
|
return [LazyMixedNamesDict(self._evaluator, self, is_instance=False)]
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return '<%s: %s>' % (type(self).__name__, repr(self.obj))
|
||||||
|
|
||||||
def __getattr__(self, name):
|
def __getattr__(self, name):
|
||||||
return getattr(self._definition, name)
|
return getattr(self._definition, name)
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ Tests of ``jedi.api.Interpreter``.
|
|||||||
from ..helpers import TestCase
|
from ..helpers import TestCase
|
||||||
import jedi
|
import jedi
|
||||||
from jedi._compatibility import is_py33
|
from jedi._compatibility import is_py33
|
||||||
|
from jedi.evaluate.compiled import mixed
|
||||||
|
|
||||||
class _GlobalNameSpace():
|
class _GlobalNameSpace():
|
||||||
class SideEffectContainer():
|
class SideEffectContainer():
|
||||||
@@ -56,6 +57,9 @@ def test_side_effect_completion():
|
|||||||
we need some mixed kind of magic for tests.
|
we need some mixed kind of magic for tests.
|
||||||
"""
|
"""
|
||||||
_GlobalNameSpace.SideEffectContainer.foo = 1
|
_GlobalNameSpace.SideEffectContainer.foo = 1
|
||||||
|
side_effect = get_completion('SideEffectContainer', _GlobalNameSpace.__dict__)
|
||||||
|
|
||||||
|
assert isinstance(side_effect._definition, mixed.MixedObject)
|
||||||
foo = get_completion('SideEffectContainer.foo', _GlobalNameSpace.__dict__)
|
foo = get_completion('SideEffectContainer.foo', _GlobalNameSpace.__dict__)
|
||||||
assert foo.name == 'foo'
|
assert foo.name == 'foo'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user