Add `@idata(iterable)` decorator-function.
The purpose is to avoid:: @data(*[a for a in foo if a > 0])
This commit is contained in:
parent
2d0a689d3a
commit
347fe29fe8
12
ddt.py
12
ddt.py
|
@ -58,9 +58,19 @@ def data(*values):
|
|||
|
||||
Should be added to methods of instances of ``unittest.TestCase``.
|
||||
|
||||
"""
|
||||
return idata(values)
|
||||
|
||||
|
||||
def idata(iterable):
|
||||
"""
|
||||
Method decorator to add to your test methods.
|
||||
|
||||
Should be added to methods of instances of ``unittest.TestCase``.
|
||||
|
||||
"""
|
||||
def wrapper(func):
|
||||
setattr(func, DATA_ATTR, values)
|
||||
setattr(func, DATA_ATTR, iterable)
|
||||
return func
|
||||
return wrapper
|
||||
|
||||
|
|
Loading…
Reference in New Issue