20
20
# this package
21
21
from domdf_python_tools import utils
22
22
from 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
24
24
25
25
26
26
def test_pyversion ():
@@ -96,10 +96,6 @@ def test_list2str(value, expects):
96
96
assert isinstance (str_representation , str )
97
97
assert str_representation == expects
98
98
99
- str_representation = list2string (value )
100
- assert isinstance (str_representation , str )
101
- assert str_representation == expects
102
-
103
99
104
100
@pytest .mark .parametrize (
105
101
"value, expects" ,
@@ -115,10 +111,6 @@ def test_list2str_semicolon(value, expects):
115
111
assert isinstance (str_representation , str )
116
112
assert str_representation == expects
117
113
118
- str_representation = list2string (value , sep = ';' )
119
- assert isinstance (str_representation , str )
120
- assert str_representation == expects
121
-
122
114
123
115
def test_permutations ():
124
116
data = ["egg and bacon" , "egg sausage and bacon" , "egg and spam" , "egg bacon and spam" ]
@@ -384,3 +376,24 @@ def test_len(capsys):
384
376
assert captured .out .splitlines () == ["0" , "1" , "2" , "3" , "4" , "5" , "6" , "7" , "8" , "9" , "10" ]
385
377
386
378
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