Message181507
| Author |
Miklós.Fazekas |
| Recipients |
Julian, Miklós.Fazekas, Yaroslav.Halchenko, abingham, bfroehle, borja.ruiz, brian.curtin, chris.jerdonek, eric.araujo, eric.snow, exarkun, ezio.melotti, fperez, hpk, kynan, michael.foord, nchauvat, ncoghlan, pitrou, r.david.murray, santoso.wijaya, spiv |
| Date |
2013年02月06日.09:37:32 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1360143453.16.0.386539193829.issue7897@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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 |
|
History
|
|---|
| 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 |
|