mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-16 02:27:06 +08:00
temporary very unfinished solution for the *args/**kwargs combination problem, if they are used in common with dynamic params. This doesn't solve the issue entirely, but it's at least a start and will probably solve all autocompletion issues. However, static analysis needs a little bit more than that.
This commit is contained in:
@@ -61,3 +61,35 @@ kwargs_nested()
|
||||
kwargs_nested(c=2, d=4)
|
||||
#! 13 type-error-multiple-values
|
||||
kwargs_nested(c=2, a=4)
|
||||
|
||||
# -----------------
|
||||
# mixed *args/**kwargs
|
||||
# -----------------
|
||||
|
||||
def simple_mixed(a, b, c):
|
||||
return b
|
||||
|
||||
|
||||
def mixed(*args, **kwargs):
|
||||
return simple_mixed(1, *args, **kwargs)
|
||||
|
||||
mixed(1, 2)
|
||||
mixed(1, c=2)
|
||||
mixed(b=2, c=3)
|
||||
mixed(c=4, b='')
|
||||
|
||||
# need separate functions, otherwise these might swallow the errors
|
||||
def mixed2(*args, **kwargs):
|
||||
return simple_mixed(1, *args, **kwargs)
|
||||
|
||||
|
||||
#! 6 type-error-too-few-arguments
|
||||
mixed2(c=2)
|
||||
#! 6 type-error-too-few-arguments
|
||||
mixed2(3)
|
||||
#! 13 type-error-too-many-arguments
|
||||
mixed2(3, 4, 5)
|
||||
#! 13 type-error-too-many-arguments
|
||||
mixed2(3, 4, c=5)
|
||||
#! 6 type-error-multiple-values
|
||||
mixed2(3, b=5)
|
||||
|
||||
@@ -26,12 +26,12 @@ def assert_static_analysis(case, actual, desired):
|
||||
d = set(desired)
|
||||
assert actual == desired, """
|
||||
Test %r failed.
|
||||
specified, not raised = %s
|
||||
missing = %s
|
||||
not raised = %s
|
||||
unspecified = %s
|
||||
""" % (case, sorted(d - a), sorted(a - d))
|
||||
|
||||
|
||||
def test_integration(case, monkeypatch):
|
||||
def test_completion(case, monkeypatch):
|
||||
if case.skip is not None:
|
||||
pytest.skip(case.skip)
|
||||
repo_root = helpers.root_dir
|
||||
|
||||
Reference in New Issue
Block a user