<div class="gmail_quote">On Thu, Aug 5, 2010 at 20:56, Michael Foord <span dir="ltr">&lt;<a href="mailto:fuzzyman@voidspace.org.uk">fuzzyman@voidspace.org.uk</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On 06/08/2010 02:49, Jesse Noller wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Thu, Aug 5, 2010 at 9:31 PM, Michael Foord&lt;<a href="mailto:fuzzyman@voidspace.org.uk" target="_blank">fuzzyman@voidspace.org.uk</a>&gt;  wrote:<br>
   <br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 06/08/2010 02:23, Jesse Noller wrote:<br>
     <br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
[snip...]<br>
ps: If nose2/unittest2 could find it in it&#39;s shiny new innocent heart<br>
to say, have support for test generators; I&#39;d die happy.<br>
<br>
       <br>
</blockquote>
Well there&#39;s another discussion :-)<br>
<br>
It would be very simple to support parameterized tests (of some form), where<br>
the number of tests can be known at test load time. Supporting generative<br>
tests - where the tests are generated at *test run time* is uglier.<br>
<br>
Would parameterized tests, where the tests are all generated at test load<br>
time, suffice or do you have a use case for generative tests where the tests<br>
have to be generated whilst the tests are running and not when the tests are<br>
loaded?<br>
<br>
Michael<br>
     <br>
</blockquote>
For me? To be honest, 98% of my (and the people around me) use cases<br>
are the parameterized case - the test generator syntax is just pure<br>
awesome (Ok, so I really like it) tests generated at run time tends to<br>
rub most people wrong :)<br>
   <br>
</blockquote>
<br></div>
Ok. Good syntax is generally a good thing, and there is no reason why a generator couldn&#39;t be called at test load time to generate the tests - perhaps in conjunction with a decorator so we don&#39;t have to do horrible introspection to determine if something is a test generator or not.<br>

<br>
Could you give me an example usage please, so I can think about how to support it (probably initially as a plugin).<br>
<br>
All the best,<br>
<br>
Michael</blockquote><div><br></div><div>I&#39;ve wanted to do something like this in the past...</div><div><br></div><div>@unittest.params((1, 1), (2, 0),  (1, 2))</div><div>def test_addition(self, x, y):</div><div>    self.assertEqual(x + y, 2)</div>
<div><br></div><div>...resulting in two passes, one fail.</div><div><br></div><div>I think I already mentioned this or something like it on the Roundup issue for this topic. I have part of a patch around somewhere, but it&#39;s far from complete.</div>
</div>