mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 05:54:25 +08:00
Remove a few unicode references in tests
This commit is contained in:
@@ -9,7 +9,6 @@ import pytest
|
||||
from pytest import raises
|
||||
from parso import cache
|
||||
|
||||
from jedi._compatibility import unicode
|
||||
from jedi import preload_module
|
||||
from jedi.inference.gradual import typeshed
|
||||
from test.helpers import test_dir, get_example_dir
|
||||
@@ -326,7 +325,7 @@ def test_goto_follow_builtin_imports(Script):
|
||||
|
||||
def test_docstrings_for_completions(Script):
|
||||
for c in Script('').complete():
|
||||
assert isinstance(c.docstring(), (str, unicode))
|
||||
assert isinstance(c.docstring(), str)
|
||||
|
||||
|
||||
def test_fuzzy_completion(Script):
|
||||
|
||||
@@ -7,7 +7,7 @@ def test_goto_keyword(Script):
|
||||
"""
|
||||
Bug: goto assignments on ``in`` used to raise AttributeError::
|
||||
|
||||
'unicode' object has no attribute 'generate_call_path'
|
||||
'str' object has no attribute 'generate_call_path'
|
||||
"""
|
||||
Script('in').goto()
|
||||
|
||||
|
||||
@@ -37,18 +37,14 @@ def test_unicode_attribute(Script):
|
||||
|
||||
def test_multibyte_script(Script):
|
||||
""" `jedi.Script` must accept multi-byte string source. """
|
||||
try:
|
||||
code = u("import datetime; datetime.d")
|
||||
comment = u("# multi-byte comment あいうえおä")
|
||||
s = (u('%s\n%s') % (code, comment)).encode('utf-8')
|
||||
except NameError:
|
||||
pass # python 3 has no unicode method
|
||||
else:
|
||||
assert len(Script(s).complete(1, len(code)))
|
||||
code = u("import datetime; datetime.d")
|
||||
comment = u("# multi-byte comment あいうえおä")
|
||||
s = (u('%s\n%s') % (code, comment))
|
||||
assert len(Script(s).complete(1, len(code)))
|
||||
|
||||
|
||||
def test_goto_definition_at_zero(Script):
|
||||
"""At zero usually sometimes raises unicode issues."""
|
||||
"""Infer at zero sometimes raises issues."""
|
||||
assert Script("a").infer(1, 1) == []
|
||||
s = Script("str").infer(1, 1)
|
||||
assert len(s) == 1
|
||||
|
||||
@@ -40,7 +40,7 @@ def test_goto_assignment(Script, source, solution):
|
||||
def test_simple_completions(Script):
|
||||
# completion
|
||||
completions = script_with_path(Script, 'from pkg import ').complete()
|
||||
names = [str(c.name) for c in completions] # str because of unicode
|
||||
names = [c.name for c in completions]
|
||||
compare = ['foo', 'ns1_file', 'ns1_folder', 'ns2_folder', 'ns2_file',
|
||||
'pkg_resources', 'pkgutil', '__name__', '__path__',
|
||||
'__package__', '__file__', '__doc__']
|
||||
|
||||
Reference in New Issue
Block a user