@@ -21,6 +21,7 @@ def squeeze(x, /, axis):
2121
2222"""
2323from collections import defaultdict
24+ from copy import copy
2425from inspect import Parameter , Signature , signature
2526from types import FunctionType
2627from typing import Any , Callable , Dict , Literal , get_args
@@ -194,7 +195,7 @@ def _test_uninspectable_func(func_name: str, func: Callable, stub_sig: Signature
194195 "manually to test the signature."
195196 )
196197
197- argname_to_arg = func_to_specified_args [func_name ]
198+ argname_to_arg = copy ( func_to_specified_args [func_name ])
198199 argname_to_expr = func_to_specified_arg_exprs [func_name ]
199200 for argname , expr in argname_to_expr .items ():
200201 assert argname not in argname_to_arg .keys () # sanity check
@@ -238,8 +239,11 @@ def _test_uninspectable_func(func_name: str, func: Callable, stub_sig: Signature
238239 if len (posorkw_args ) == 0 :
239240 func (* posargs , ** kwargs )
240241 else :
241- func (* posargs , ** posorkw_args , ** kwargs )
242- # TODO: test all positional and keyword permutations of pos-or-kw args
242+ posorkw_name_to_arg_pairs = list (posorkw_args .items ())
243+ for i in range (len (posorkw_name_to_arg_pairs ), - 1 , - 1 ):
244+ extra_posargs = [arg for _ , arg in posorkw_name_to_arg_pairs [:i ]]
245+ extra_kwargs = dict (posorkw_name_to_arg_pairs [i :])
246+ func (* posargs , * extra_posargs , ** kwargs , ** extra_kwargs )
243247
244248
245249def _test_func_signature (func : Callable , stub : FunctionType , is_method = False ):
0 commit comments