mirror of
https://github.com/davidhalter/jedi.git
synced 2026-01-28 12:52:09 +08:00
Some testing fixes that were broken with the few previous commits.
This commit is contained in:
@@ -45,7 +45,7 @@ class TestFullNameWithGotoDefinitions(MixinTestFullName, TestCase):
|
||||
self.check("""
|
||||
import re
|
||||
any_re = re.compile('.*')
|
||||
any_re""", '_sre.compile.SRE_Pattern')
|
||||
any_re""", '_sre.SRE_Pattern')
|
||||
|
||||
def test_from_import(self):
|
||||
self.check('from os import path', 'os.path')
|
||||
|
||||
@@ -97,8 +97,8 @@ def test_not_importable_file():
|
||||
def test_import_unique():
|
||||
src = "import os; os.path"
|
||||
defs = jedi.Script(src, path='example.py').goto_definitions()
|
||||
defs = [d._name.parent_context for d in defs]
|
||||
assert len(defs) == len(set(defs))
|
||||
parent_contexts = [d._name._context for d in defs]
|
||||
assert len(parent_contexts) == len(set(parent_contexts))
|
||||
|
||||
|
||||
def test_cache_works_with_sys_path_param(tmpdir):
|
||||
|
||||
@@ -4,8 +4,8 @@ from jedi import Script
|
||||
|
||||
|
||||
def get_definition_and_evaluator(source):
|
||||
d = Script(dedent(source)).goto_definitions()[0]
|
||||
return d._name.parent_context, d._evaluator
|
||||
first, = Script(dedent(source)).goto_definitions()
|
||||
return first._name._context, first._evaluator
|
||||
|
||||
|
||||
def test_function_execution():
|
||||
|
||||
@@ -121,7 +121,7 @@ class TokenTest(unittest.TestCase):
|
||||
def test_tokenizer_with_string_literal_backslash():
|
||||
import jedi
|
||||
c = jedi.Script("statement = u'foo\\\n'; statement").goto_definitions()
|
||||
assert c[0]._name.parent_context.obj == 'foo'
|
||||
assert c[0]._name._context.obj == 'foo'
|
||||
|
||||
|
||||
def test_ur_literals():
|
||||
|
||||
Reference in New Issue
Block a user