5 Commits

Author SHA1 Message Date
maxalbert
4ce52c8349 Merge c078c42a94 into 6aee460b1d 2025-01-14 11:53:10 +00:00
Maximilian Albert
c078c42a94 Rename test module to minimise risk of unexpected side-effects due to polluting sys.modules 2025-01-14 11:53:04 +00:00
Maximilian Albert
1ce0d00fb6 Modify test so that it actually reproduces the bug in #2044 2025-01-14 11:43:00 +00:00
Maximilian Albert
61848afc7c Add regression test for #2044 2025-01-13 19:10:41 +00:00
Maximilian Albert
a4ec9e0b2b Add example folder for testing implicit namespacepackage with subpackages 2025-01-09 20:36:10 +00:00
3 changed files with 19 additions and 0 deletions

View File

@@ -9,8 +9,10 @@ import pytest
import jedi
import jedi.settings
from jedi import Project
from jedi.inference.compiled import mixed
from importlib import import_module
from test.helpers import get_example_dir
class _GlobalNameSpace:
@@ -591,6 +593,23 @@ def test_dict_completion(code, column, expected):
assert [c.complete for c in comps] == expected
def test_implicit_namespace_package_with_subpackages(monkeypatch):
sys_path_dir1 = get_example_dir('implicit_namespace_package_with_subpackages', 'ns1')
sys_path_dir2 = get_example_dir('implicit_namespace_package_with_subpackages', 'ns2')
monkeypatch.syspath_prepend(sys_path_dir1)
monkeypatch.syspath_prepend(sys_path_dir2)
import pkg_implicit_namespace_package_test
interpreter = jedi.Interpreter(
"pkg_implicit_namespace_package_test.",
namespaces=[locals()],
project=Project('.')
)
comps = interpreter.complete()
expected = ["pkgA", "pkgB"]
assert [c.complete for c in comps] == expected
@pytest.mark.parametrize(
'code, types', [
('dct[1]', ['int']),