mirror of
https://github.com/davidhalter/jedi.git
synced 2026-02-17 03:44:12 +08:00
A few Python 2 fixes
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
# python >= 3.4
|
||||
from stub_folder import with_stub, stub_only, with_stub_folder, stub_only_folder
|
||||
|
||||
# -------------------------
|
||||
|
||||
@@ -119,11 +119,7 @@ def test_goto_assignments_on_non_name(Script, environment):
|
||||
assert Script('for').goto_assignments() == []
|
||||
|
||||
assert Script('assert').goto_assignments() == []
|
||||
if environment.version_info.major == 2:
|
||||
# In Python 2.7 True is still a name.
|
||||
assert Script('True').goto_assignments()[0].description == 'instance True'
|
||||
else:
|
||||
assert Script('True').goto_assignments() == []
|
||||
assert Script('True').goto_assignments() == []
|
||||
|
||||
|
||||
def test_goto_definitions_on_non_name(Script):
|
||||
|
||||
@@ -60,11 +60,11 @@ def test_function(Script, environment):
|
||||
|
||||
def test_keywords_variable(Script):
|
||||
code = 'import keyword; keyword.kwlist'
|
||||
seq1, seq2 = Script(code).goto_definitions()
|
||||
assert seq1.name, seq2.name == 'Sequence'
|
||||
# This points towards the typeshed implementation
|
||||
stub_seq, = seq1.goto_stubs()
|
||||
assert typeshed.TYPESHED_PATH in stub_seq.module_path
|
||||
for seq in Script(code).goto_definitions():
|
||||
assert seq.name == 'Sequence'
|
||||
# This points towards the typeshed implementation
|
||||
stub_seq, = seq.goto_stubs()
|
||||
assert typeshed.TYPESHED_PATH in stub_seq.module_path
|
||||
|
||||
|
||||
def test_class(Script):
|
||||
|
||||
@@ -80,7 +80,7 @@ class TestSetupReadline(unittest.TestCase):
|
||||
difference = {x for x in difference if not x.startswith('from os import _')}
|
||||
# There are quite a few differences, because both Windows and Linux
|
||||
# (posix and nt) libraries are included.
|
||||
assert len(difference) < 33
|
||||
assert len(difference) < 38
|
||||
|
||||
@cwd_at('test')
|
||||
def test_local_import(self):
|
||||
|
||||
Reference in New Issue
Block a user