fix for kwargs params

This commit is contained in:
Dave Halter
2014-06-01 13:52:21 +02:00
parent 933e231d74
commit 945888a535
2 changed files with 14 additions and 3 deletions

View File

@@ -1,5 +1,4 @@
import copy import copy
from itertools import chain
from jedi._compatibility import unicode, zip_longest from jedi._compatibility import unicode, zip_longest
from jedi.parser import representation as pr from jedi.parser import representation as pr
@@ -132,7 +131,7 @@ def get_params(evaluator, func, var_args):
array_type = pr.Array.DICT array_type = pr.Array.DICT
if non_matching_keys: if non_matching_keys:
keys, values = zip(*non_matching_keys) keys, values = zip(*non_matching_keys)
values = list(chain(*values)) values = [helpers.stmts_to_stmt(list(v)) for v in values]
non_matching_keys = [] non_matching_keys = []
else: else:
# normal param # normal param

View File

@@ -47,5 +47,17 @@ kwargs_test(c=3)
kwargs_test(b=2) kwargs_test(b=2)
#! 22 type-error-keyword-argument #! 22 type-error-keyword-argument
kwargs_test(b=2, c=3, d=4) kwargs_test(b=2, c=3, d=4)
#! 22 type-error-multiple-values #! 11 type-error-multiple-values
kwargs_test(b=2, c=3, a=4) kwargs_test(b=2, c=3, a=4)
def kwargs_nested(**kwargs):
return kwargs_test(b=2, **kwargs)
kwargs_nested(c=3)
#! 13 type-error-too-few-arguments
kwargs_nested()
#! 19 type-error-keyword-argument
kwargs_nested(c=2, d=4)
#! 13 type-error-multiple-values
kwargs_nested(c=2, a=4)