forked from VimPlug/jedi
Upgrade typeshed
This commit is contained in:
@@ -173,7 +173,7 @@ def test_get_line_code(Script):
|
||||
return Script(source).complete(line=line)[0].get_line_code(**kwargs).replace('\r', '')
|
||||
|
||||
# On builtin
|
||||
assert get_line_code('abs') == 'def abs(__n: SupportsAbs[_T]) -> _T: ...\n'
|
||||
assert get_line_code('abs') == 'def abs(__x: SupportsAbs[_T]) -> _T: ...\n'
|
||||
|
||||
# On custom code
|
||||
first_line = 'def foo():\n'
|
||||
|
||||
@@ -39,12 +39,11 @@ class TestSignatures(TestCase):
|
||||
run = self._run_simple
|
||||
|
||||
# simple
|
||||
s1 = "sorted(a, bool("
|
||||
run(s1, 'sorted', 0, 7)
|
||||
run(s1, 'sorted', 1, 9)
|
||||
run(s1, 'sorted', 1, 10)
|
||||
run(s1, 'sorted', None, 11)
|
||||
run(s1, 'bool', 0, 15)
|
||||
s1 = "tuple(a, bool("
|
||||
run(s1, 'tuple', 0, 6)
|
||||
run(s1, 'tuple', None, 8)
|
||||
run(s1, 'tuple', None, 9)
|
||||
run(s1, 'bool', 0, 14)
|
||||
|
||||
s2 = "abs(), "
|
||||
run(s2, 'abs', 0, 4)
|
||||
@@ -65,9 +64,9 @@ class TestSignatures(TestCase):
|
||||
run(s4, 'abs', 0, 10)
|
||||
run(s4, 'abs', None, 11)
|
||||
|
||||
s5 = "sorted(1,\nif 2:\n def a():"
|
||||
run(s5, 'sorted', 0, 7)
|
||||
run(s5, 'sorted', 1, 9)
|
||||
s5 = "tuple(1,\nif 2:\n def a():"
|
||||
run(s5, 'tuple', 0, 6)
|
||||
run(s5, 'tuple', None, 8)
|
||||
|
||||
s6 = "bool().__eq__("
|
||||
run(s6, '__eq__', 0)
|
||||
@@ -89,8 +88,8 @@ class TestSignatures(TestCase):
|
||||
|
||||
def test_for(self):
|
||||
# jedi-vim #11
|
||||
self._run_simple("for sorted(", 'sorted', 0)
|
||||
self._run_simple("for s in sorted(", 'sorted', 0)
|
||||
self._run_simple("for tuple(", 'tuple', 0)
|
||||
self._run_simple("for s in tuple(", 'tuple', 0)
|
||||
|
||||
|
||||
def test_with(Script):
|
||||
@@ -272,7 +271,7 @@ def test_pow_params(Script):
|
||||
# See Github #1357.
|
||||
for sig in Script('pow(').get_signatures():
|
||||
param_names = [p.name for p in sig.params]
|
||||
assert param_names in (['x', 'y'], ['x', 'y', 'z'])
|
||||
assert param_names in (['base', 'exp'], ['base', 'exp', 'mod'])
|
||||
|
||||
|
||||
def test_param_name(Script):
|
||||
|
||||
@@ -195,7 +195,7 @@ def test_hashlib_params(Script, environment):
|
||||
script = Script('from hashlib import sha256')
|
||||
c, = script.complete()
|
||||
sig, = c.get_signatures()
|
||||
assert [p.name for p in sig.params] == ['arg']
|
||||
assert [p.name for p in sig.params] == ['string']
|
||||
|
||||
|
||||
def test_signature_params(Script):
|
||||
@@ -619,7 +619,7 @@ def test_definition_goto_follow_imports(Script):
|
||||
|
||||
('n = next; n', 'Union[next(__i: Iterator[_T]) -> _T, '
|
||||
'next(__i: Iterator[_T], default: _VT) -> Union[_T, _VT]]'),
|
||||
('abs', 'abs(__n: SupportsAbs[_T]) -> _T'),
|
||||
('abs', 'abs(__x: SupportsAbs[_T]) -> _T'),
|
||||
('def foo(x, y): return x if xxxx else y\nfoo(str(), 1)\nfoo',
|
||||
'foo(x: str, y: int) -> Union[int, str]'),
|
||||
('def foo(x, y = None): return x if xxxx else y\nfoo(str(), 1)\nfoo',
|
||||
|
||||
@@ -150,19 +150,6 @@ def test_async(Script, environment):
|
||||
assert 'hey' in names
|
||||
|
||||
|
||||
def test_method_doc_with_signature(Script):
|
||||
code = 'f = open("")\nf.writelin'
|
||||
c, = Script(code).complete()
|
||||
assert c.name == 'writelines'
|
||||
assert c.docstring() == 'writelines(lines: Iterable[AnyStr]) -> None'
|
||||
|
||||
|
||||
def test_method_doc_with_signature2(Script):
|
||||
code = 'f = open("")\nf.writelines'
|
||||
d, = Script(code).goto()
|
||||
assert d.docstring() == 'writelines(lines: Iterable[AnyStr]) -> None'
|
||||
|
||||
|
||||
def test_with_stmt_error_recovery(Script):
|
||||
assert Script('with open('') as foo: foo.\na').complete(line=1)
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ def test_builtin_docstring(goto_or_help_or_infer):
|
||||
d, = goto_or_help_or_infer('open')
|
||||
|
||||
doc = d.docstring()
|
||||
assert doc.startswith('open(file: Union[')
|
||||
assert doc.startswith('open(file: ')
|
||||
assert 'Open file' in doc
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user