mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 06:24:27 +08:00
Make it clear in search tests if a stub or a normal definition is expected
This commit is contained in:
@@ -38,6 +38,10 @@ class _ModuleAttributeName(AbstractNameDefinition):
|
||||
return compiled.get_string_value_set(self.parent_context.inference_state)
|
||||
|
||||
|
||||
def iter_module_names(*args, **kwargs):
|
||||
return sorted(set(iter_module_names(*args, **kwargs)))
|
||||
|
||||
|
||||
def iter_module_names(inference_state, paths):
|
||||
# Python modules/packages
|
||||
for path in paths:
|
||||
|
||||
@@ -60,12 +60,12 @@ def test_load_save_project(tmpdir):
|
||||
|
||||
('sample_int', ['helpers.sample_int'], {}),
|
||||
('sample_int', ['helpers.sample_int'], dict(all_scopes=True)),
|
||||
('sample_int.real', ['builtins.int.real'], {}),
|
||||
('sample_int.real', ['stub:builtins.int.real'], {}),
|
||||
|
||||
('class sample_int.real', [], {}),
|
||||
('foo sample_int.real', [], {}),
|
||||
('def sample_int.real', ['builtins.int.real'], {}),
|
||||
('function sample_int.real', ['builtins.int.real'], {}),
|
||||
('def sample_int.real', ['stub:builtins.int.real'], {}),
|
||||
('function sample_int.real', ['stub:builtins.int.real'], {}),
|
||||
|
||||
# With modules
|
||||
('test_project.test_search', ['test_api.test_project.test_search'], {}),
|
||||
@@ -90,8 +90,9 @@ def test_load_save_project(tmpdir):
|
||||
dict(complete=True)),
|
||||
|
||||
# On sys path
|
||||
('sys.path', ['sys.path'], {}),
|
||||
('json.dumps', ['json.dumps', 'json.dumps'], {}), # stdlib + stub
|
||||
('sys.path', ['stub:sys.path'], {}),
|
||||
('json.dumps', ['stub:json.dumps', 'json.dumps'], {}), # stdlib + stub
|
||||
('multiprocessing', ['stub:multiprocessing'], {})
|
||||
]
|
||||
)
|
||||
@pytest.mark.skipif(sys.version_info < (3, 6), reason="Ignore Python 2, because EOL")
|
||||
@@ -99,4 +100,4 @@ def test_search(string, full_names, kwargs, skip_pre_python36):
|
||||
some_search_test_var = 1.0
|
||||
project = Project(test_dir)
|
||||
defs = project.search(string, **kwargs)
|
||||
assert [d.full_name for d in defs] == full_names
|
||||
assert [('stub:' if d.is_stub() else '') + d.full_name for d in defs] == full_names
|
||||
|
||||
Reference in New Issue
Block a user