forked from VimPlug/jedi
add a new static_analysis file to test star arguments separately
This commit is contained in:
@@ -49,6 +49,8 @@ def _get_calling_var_args(evaluator, var_args):
|
||||
param = names[0].parent
|
||||
if not isinstance(param, ExecutedParam):
|
||||
break
|
||||
# We never want var_args to be a tuple. This should be enough for
|
||||
# now, we can change it later, if we need to.
|
||||
if isinstance(param.var_args, pr.Array):
|
||||
var_args = param.var_args
|
||||
return var_args
|
||||
|
||||
@@ -13,12 +13,6 @@ simple()
|
||||
simple(1, 2)
|
||||
|
||||
|
||||
def nested(*args):
|
||||
return simple(*args)
|
||||
|
||||
nested(1)
|
||||
#! 6 type-error-too-few-arguments
|
||||
nested()
|
||||
#! 10 type-error-too-many-arguments
|
||||
simple(1, 2, 3)
|
||||
|
||||
|
||||
10
test/static_analysis/star_arguments.py
Normal file
10
test/static_analysis/star_arguments.py
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
def simple(a):
|
||||
return a
|
||||
|
||||
def nested(*args):
|
||||
return simple(*args)
|
||||
|
||||
nested(1)
|
||||
#! 6 type-error-too-few-arguments
|
||||
nested()
|
||||
Reference in New Issue
Block a user