Merge pull request #1820 from davidhalter/changes

Some Changes for 0.18.1
This commit is contained in:
Dave Halter
2021-11-17 01:42:55 +01:00
committed by GitHub
18 changed files with 121 additions and 21 deletions

View File

@@ -44,6 +44,8 @@ b[int():]
#? list()
b[:]
#? int()
b[:, :-1]
#? 3
b[:]
@@ -67,6 +69,20 @@ class _StrangeSlice():
#? slice()
_StrangeSlice()[1:2]
for x in b[:]:
#? int()
x
for x in b[:, :-1]:
#?
x
class Foo:
def __getitem__(self, item):
return item
#?
Foo()[:, :-1][0]
# -----------------
# iterable multiplication

View File

@@ -284,6 +284,13 @@ def doctest_with_space():
import_issu
"""
def doctest_issue_github_1748():
"""From GitHub #1748
#? 10 []
This. Al
"""
pass
def docstring_rst_identifiers():
"""

View File

@@ -1,3 +1,5 @@
from typing import Generator
import pytest
from pytest import fixture
@@ -169,3 +171,15 @@ def test_inheritance_fixture(inheritance_fixture, caplog):
@pytest.fixture
def caplog(caplog):
yield caplog
# -----------------
# Generator with annotation
# -----------------
@pytest.fixture
def with_annot() -> Generator[float, None, None]:
pass
def test_with_annot(inheritance_fixture, with_annot):
#? float()
with_annot

View File

@@ -457,3 +457,7 @@ def test_module_completions(Script, module):
# Just make sure that there are no errors
c.type
c.docstring()
def test_whitespace_at_end_after_dot(Script):
assert 'strip' in [c.name for c in Script('str. ').complete()]

View File

@@ -37,6 +37,17 @@ def test_operator_doc(Script):
assert len(d.docstring()) > 100
@pytest.mark.parametrize(
'code, help_part', [
('str', 'Create a new string object'),
('str.strip', 'Return a copy of the string'),
]
)
def test_stdlib_doc(Script, code, help_part):
h, = Script(code).help()
assert help_part in h.docstring(raw=True)
def test_lambda(Script):
d, = Script('lambda x: x').help(column=0)
assert d.type == 'keyword'

View File

@@ -732,3 +732,10 @@ def test_complete_not_findable_class_source():
assert "ta" in [c.name for c in completions]
assert "ta1" in [c.name for c in completions]
def test_param_infer_default():
abs_sig, = jedi.Interpreter('abs(', [{'abs': abs}]).get_signatures()
param, = abs_sig.params
assert param.name == 'x'
assert param.infer_default() == []

View File

@@ -189,3 +189,9 @@ def test_no_error(get_names):
def test_is_side_effect(get_names, code, index, is_side_effect):
names = get_names(code, references=True, all_scopes=True)
assert names[index].is_side_effect() == is_side_effect
def test_no_defined_names(get_names):
definition, = get_names("x = (1, 2)")
assert not definition.defined_names()

View File

@@ -85,7 +85,7 @@ class TestSetupReadline(unittest.TestCase):
}
# There are quite a few differences, because both Windows and Linux
# (posix and nt) librariesare included.
assert len(difference) < 15
assert len(difference) < 30
def test_local_import(self):
s = 'import test.test_utils'