[TIP] Meta-test methods...

laidler at stsci.edu laidler at stsci.edu
Fri Apr 24 17:11:56 PDT 2009



---- Original message ----
>Date: Sat, 25 Apr 2009 09:37:42 +1000
>From: testing-in-python-bounces at lists.idyll.org (on behalf of Robert Collins <robertc at robertcollins.net>)
>class GeneratingSomeTests(TestSuite):
>
>    def __iter__(self):
>        for _ in range(4000):
>            def test():
>                assert 1 == 2
>            yield FunctionTestCase(test)
>
>AIUI this is the sort of thing you mean? I realise this is spelt
>slightly more verbosely than nose does - but it [clearly] is possible to
>take an iterable and wrap it programatically. Personally I find tests
>generated like this (nose style or as above) somewhat awkward. I'm
>curious what sort of testing problems you (and Titus and ...) find
>generated tests attractive for.

Much of the code I write is for data analysis, which can follow
different control flows, invoke different algorithms, and 
encounter different pathological conditions depending on what
datasets are fed into it.

So when I test, I want to make sure my tests probe most
regions of the potential parameter space of input data. I use
generated tests to run exactly the same test with varying
inputs.

Vicki



More information about the testing-in-python mailing list