forked from VimPlug/jedi
Change a few tests to match new typeshed
This commit is contained in:
@@ -86,7 +86,7 @@ def test_time_docstring():
|
||||
import time
|
||||
comp, = jedi.Script('import time\ntime.sleep').complete()
|
||||
assert comp.docstring(raw=True) == time.sleep.__doc__
|
||||
expected = 'sleep(secs: float) -> None\n\n' + time.sleep.__doc__
|
||||
expected = 'sleep(seconds: _SupportsFloatOrIndex, /) -> None\n\n' + time.sleep.__doc__
|
||||
assert comp.docstring() == expected
|
||||
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ def test_instance_doc(Script):
|
||||
'''Docstring of `TestClass`.'''
|
||||
tc = TestClass()
|
||||
tc""").infer()
|
||||
assert defs[0].docstring() == 'Docstring of `TestClass`.'
|
||||
assert defs[0].docstring() == 'TestClass()\n\nDocstring of `TestClass`.'
|
||||
|
||||
|
||||
def test_multiple_docstrings(Script):
|
||||
|
||||
@@ -10,20 +10,20 @@ def test_sqlite3_conversion(Script):
|
||||
script1 = Script('import sqlite3; sqlite3.Connection')
|
||||
d, = script1.infer()
|
||||
|
||||
assert not d.module_path
|
||||
assert d.module_path
|
||||
assert d.full_name == 'sqlite3.Connection'
|
||||
assert convert_names([d._name], only_stubs=True)
|
||||
|
||||
d, = script1.infer(only_stubs=True)
|
||||
assert d.is_stub()
|
||||
assert d.full_name == 'sqlite3.dbapi2.Connection'
|
||||
assert d.full_name == 'sqlite3.Connection'
|
||||
|
||||
script2 = Script(path=d.module_path)
|
||||
d, = script2.infer(line=d.line, column=d.column)
|
||||
assert not d.is_stub()
|
||||
assert d.is_stub()
|
||||
assert d.full_name == 'sqlite3.Connection'
|
||||
v, = d._name.infer()
|
||||
assert v.is_compiled()
|
||||
assert not v.is_compiled()
|
||||
|
||||
|
||||
def test_conversion_of_stub_only(Script):
|
||||
@@ -70,11 +70,11 @@ def test_stub_get_line_code(Script):
|
||||
script = Script(code)
|
||||
d, = script.goto(only_stubs=True)
|
||||
# Replace \r for tests on Windows
|
||||
assert d.get_line_code().replace('\r', '') == 'class ABC(metaclass=ABCMeta): ...\n'
|
||||
assert d.get_line_code().replace('\r', '') == 'class ABC(metaclass=ABCMeta):\n'
|
||||
del parser_cache[script._inference_state.latest_grammar._hashed][d.module_path]
|
||||
d, = Script(path=d.module_path).goto(d.line, d.column, only_stubs=True)
|
||||
assert d.is_stub()
|
||||
assert d.get_line_code().replace('\r', '') == 'class ABC(metaclass=ABCMeta): ...\n'
|
||||
assert d.get_line_code().replace('\r', '') == 'class ABC(metaclass=ABCMeta):\n'
|
||||
|
||||
|
||||
def test_os_stat_result(Script):
|
||||
|
||||
Reference in New Issue
Block a user