Miklós Fazekas added the comment:
http://gist.github.com/mfazekas/1710455
I have a parametric delclarator which works is similiar to sweepargs in
concept. It can be either applied at class or method level. And it mutates
testnames so failure should be nice, and filters can be applied too.
@parametric
class MyTest(unittest.TestCase):
@parametric(foo=[1,2],bar=[3,4])
def testWithParams(self,foo,bar):
self.assertLess(foo,bar)
def testNormal(self):
self.assertEqual('foo','foo')
@parametric(foo=[1,2],bar=[3,4])
class MyTest(unittest.TestCase):
def testPositive(self,foo,bar):
self.assertLess(foo,bar)
def testNegative(self,foo,bar):
self.assertLess(-foo,-bar)
Sample failures:
======================================================================
FAIL: testNegative_bar_3_foo_1 (__main__.MyTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Work/temp/parametric.py", line 63, in f
self.fun(*args,**v)
File "/Work/temp/parametric.py", line 158, in testNegative
self.assertLess(-foo,-bar)
AssertionError: -1 not less than -3
======================================================================
FAIL: testNegative_bar_3_foo_2 (__main__.MyTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Work/temp/parametric.py", line 63, in f
self.fun(*args,**v)
File "/Work/temp/parametric.py", line 158, in testNegative
self.assertLess(-foo,-bar)
AssertionError: -2 not less than -3
----------
nosy: +Miklós.Fazekas
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue7897>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com