Message181507
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 |
|
Date |
User |
Action |
Args |
2013-02-06 09:37:33 | Miklós.Fazekas | set | recipients:
+ Miklós.Fazekas, spiv, exarkun, ncoghlan, pitrou, ezio.melotti, eric.araujo, r.david.murray, michael.foord, brian.curtin, hpk, fperez, chris.jerdonek, Yaroslav.Halchenko, santoso.wijaya, nchauvat, kynan, Julian, abingham, eric.snow, borja.ruiz, bfroehle |
2013-02-06 09:37:33 | Miklós.Fazekas | set | messageid: <1360143453.16.0.386539193829.issue7897@psf.upfronthosting.co.za> |
2013-02-06 09:37:33 | Miklós.Fazekas | link | issue7897 messages |
2013-02-06 09:37:32 | Miklós.Fazekas | create | |
|