Some progress in trying to make the deque work

This commit is contained in:
Dave Halter
2019-06-14 09:36:10 +02:00
parent 4564275eba
commit 3ed30409ea
5 changed files with 54 additions and 6 deletions

View File

@@ -24,6 +24,8 @@ from test.helpers import root_dir
['from collections import Counter; Counter()', 'collections.Counter', True, True, {}],
['from collections import Counter; Counter.most_common',
'collections.Counter.most_common', True, True, {}],
#['from collections import deque',
#('_collections.deque', 'collections.deque'), True, False, {}],
['from keyword import kwlist; kwlist', 'typing.Sequence', True, True,
{'full_name': 'keyword.kwlist'}],
@@ -41,6 +43,11 @@ def test_infer_and_goto(Script, code, full_name, has_stub, has_python, way,
s = Script(code, _project=project)
prefer_stubs = kwargs['prefer_stubs']
only_stubs = kwargs['only_stubs']
if isinstance(full_name, tuple):
# Small hack to make it possible to test some special cases.
should_land_on_stub = has_stub and (only_stubs or prefer_stubs)
full_name = full_name[should_land_on_stub]
if type_ == 'goto':
full_name = goto_changes.get('full_name', full_name)
if way == 'direct':
@@ -70,3 +77,5 @@ def test_infer_and_goto(Script, code, full_name, has_stub, has_python, way,
if only_stubs:
assert d.is_stub()
assert d.full_name == full_name
#if d.is_stub():
#assert d.module_path.endswith('.pyi')