summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_email/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_email/__init__.py')
-rw-r--r--Lib/test/test_email/__init__.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/Lib/test/test_email/__init__.py b/Lib/test/test_email/__init__.py
index 1600159..888751e 100644
--- a/Lib/test/test_email/__init__.py
+++ b/Lib/test/test_email/__init__.py
@@ -120,6 +120,10 @@ def parameterize(cls):
Note: if and only if the generated test name is a valid identifier can it
be used to select the test individually from the unittest command line.
+ The values in the params dict can be a single value, a tuple, or a
+ dict. If a single value of a tuple, it is passed to the test function
+ as positional arguments. If a dict, it is a passed via **kw.
+
"""
paramdicts = {}
testers = collections.defaultdict(list)
@@ -148,8 +152,12 @@ def parameterize(cls):
if name.startswith(paramsname):
testnameroot = 'test_' + name[len(paramsname):]
for paramname, params in paramsdict.items():
- test = (lambda self, name=name, params=params:
- getattr(self, name)(*params))
+ if hasattr(params, 'keys'):
+ test = (lambda self, name=name, params=params:
+ getattr(self, name)(**params))
+ else:
+ test = (lambda self, name=name, params=params:
+ getattr(self, name)(*params))
testname = testnameroot + '_' + paramname
test.__name__ = testname
testfuncs[testname] = test