2020# this package
2121from domdf_python_tools import utils
2222from domdf_python_tools .testing import testing_boolean_values
23- from domdf_python_tools .utils import Len , chunks , double_chain , list2str , list2string , pyversion , str2tuple
23+ from domdf_python_tools .utils import Len , chunks , double_chain , list2str , posargs2kwargs , pyversion , str2tuple
2424
2525
2626def test_pyversion ():
@@ -96,10 +96,6 @@ def test_list2str(value, expects):
9696 assert isinstance (str_representation , str )
9797 assert str_representation == expects
9898
99- str_representation = list2string (value )
100- assert isinstance (str_representation , str )
101- assert str_representation == expects
102-
10399
104100@pytest .mark .parametrize (
105101 "value, expects" ,
@@ -115,10 +111,6 @@ def test_list2str_semicolon(value, expects):
115111 assert isinstance (str_representation , str )
116112 assert str_representation == expects
117113
118- str_representation = list2string (value , sep = ';' )
119- assert isinstance (str_representation , str )
120- assert str_representation == expects
121-
122114
123115def test_permutations ():
124116 data = ["egg and bacon" , "egg sausage and bacon" , "egg and spam" , "egg bacon and spam" ]
@@ -384,3 +376,24 @@ def test_len(capsys):
384376 assert captured .out .splitlines () == ["0" , "1" , "2" , "3" , "4" , "5" , "6" , "7" , "8" , "9" , "10" ]
385377
386378 assert Len ("Hello" ) == range (5 )
379+
380+
381+ def demo_function (arg1 , arg2 , arg3 ):
382+ pass
383+
384+
385+ @pytest .mark .parametrize (
386+ "args, posarg_names, kwargs, expects" ,
387+ [
388+ ((1 , 2 , 3 ), ("arg1" , "arg2" , "arg3" ), {}, {"arg1" : 1 , "arg2" : 2 , "arg3" : 3 }),
389+ ((1 , 2 , 3 ), ("arg1" , "arg2" , "arg3" ), None , {"arg1" : 1 , "arg2" : 2 , "arg3" : 3 }),
390+ ((1 , 2 , 3 ), ("arg1" , "arg2" , "arg3" ), {"arg4" : 4 }, {"arg1" : 1 , "arg2" : 2 , "arg3" : 3 , "arg4" : 4 }),
391+ ((1 , 2 , 3 ), demo_function , None , {
392+ "arg1" : 1 ,
393+ "arg2" : 2 ,
394+ "arg3" : 3 ,
395+ }),
396+ ]
397+ )
398+ def test_posargs2kwargs (args , posarg_names , kwargs , expects ):
399+ assert posargs2kwargs (args , posarg_names , kwargs ) == expects
0 commit comments