mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 14:34:31 +08:00
Fix deprecations in tests
This commit is contained in:
@@ -450,7 +450,7 @@ def test_completion_cache(Script, module_injector):
|
|||||||
|
|
||||||
@pytest.mark.parametrize('module', ['typing', 'os'])
|
@pytest.mark.parametrize('module', ['typing', 'os'])
|
||||||
def test_module_completions(Script, module):
|
def test_module_completions(Script, module):
|
||||||
for c in Script('import {module}; {module}.'.format(module=module)).completions():
|
for c in Script('import {module}; {module}.'.format(module=module)).complete():
|
||||||
# Just make sure that there are no errors
|
# Just make sure that there are no errors
|
||||||
c.type
|
c.type
|
||||||
c.docstring()
|
c.docstring()
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ def test_version_info(Script):
|
|||||||
|
|
||||||
sys.version_info"""))
|
sys.version_info"""))
|
||||||
|
|
||||||
c, = s.completions()
|
c, = s.complete()
|
||||||
assert c.docstring() == 'sys.version_info\n\nVersion information as a named tuple.'
|
assert c.docstring() == 'sys.version_info\n\nVersion information as a named tuple.'
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -678,5 +678,5 @@ def bar():
|
|||||||
def test_string_annotation(annotations, result, code):
|
def test_string_annotation(annotations, result, code):
|
||||||
x = lambda foo: 1
|
x = lambda foo: 1
|
||||||
x.__annotations__ = annotations
|
x.__annotations__ = annotations
|
||||||
defs = jedi.Interpreter(code or 'x()', [locals()]).goto_definitions()
|
defs = jedi.Interpreter(code or 'x()', [locals()]).infer()
|
||||||
assert [d.name for d in defs] == result
|
assert [d.name for d in defs] == result
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|||||||
@@ -136,10 +136,13 @@ def test_math(Script):
|
|||||||
assert value
|
assert value
|
||||||
|
|
||||||
|
|
||||||
def test_type_var(Script):
|
def test_type_var(Script, environment):
|
||||||
def_, = Script('import typing; T = typing.TypeVar("T1")').infer()
|
def_, = Script('import typing; T = typing.TypeVar("T1")').infer()
|
||||||
assert def_.name == 'TypeVar'
|
assert def_.name == 'TypeVar'
|
||||||
assert def_.description == 'class TypeVar'
|
if environment.version_info.major == 2:
|
||||||
|
assert def_.description == 'TypeVar = object()'
|
||||||
|
else:
|
||||||
|
assert def_.description == 'class TypeVar'
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
|
|||||||
Reference in New Issue
Block a user