1
0
forked from VimPlug/jedi

Fix issues with getitem on compiled objects that have annotations, see #1719

This commit is contained in:
Dave Halter
2021-01-17 13:47:36 +01:00
parent 47d0318fa6
commit 387d73990b
3 changed files with 29 additions and 3 deletions

View File

@@ -603,8 +603,11 @@ def test_dict_getitem(code, types):
@pytest.mark.parametrize(
'code, expected', [
('DunderCls()[0]', 'int'),
('dunder[0]', 'int'),
('next(DunderCls())', 'float'),
('next(dunder)', 'float'),
('for x in DunderCls(): x', 'str'),
#('for x in dunder: x', 'str'),
]
)
def test_dunders(class_is_findable, code, expected):
@@ -623,6 +626,8 @@ def test_dunders(class_is_findable, code, expected):
if not class_is_findable:
DunderCls.__name__ = 'asdf'
dunder = DunderCls()
n, = jedi.Interpreter(code, [locals()]).infer()
assert n.name == expected