diff options
author | Ralf Gommers <ralf.gommers@googlemail.com> | 2012-07-15 17:30:22 +0200 |
---|---|---|
committer | Ralf Gommers <ralf.gommers@googlemail.com> | 2012-07-15 17:30:22 +0200 |
commit | 23dba57bced24f74e1c0a80865f0efa617c90a33 (patch) | |
tree | f7a9ff1edf533be90380ce89ae2e57a0cc6a43e0 /doc | |
parent | f9c68672f457de5a55f3919a26da865070340acb (diff) | |
download | numpy-23dba57bced24f74e1c0a80865f0efa617c90a33.tar.gz |
DOC: add details on how to use generator tests to documentation.
Thanks to Pauli Virtanen for this useful suggestion.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/TESTS.rst.txt | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/doc/TESTS.rst.txt b/doc/TESTS.rst.txt index 9bde1849f..8f8da8c18 100644 --- a/doc/TESTS.rst.txt +++ b/doc/TESTS.rst.txt @@ -198,6 +198,15 @@ Note that 'check_even' is not itself a test (no 'test' in the name), but 'test_evens' is a generator that returns a series of tests, using 'check_even', across a range of inputs. +A problem with generator tests can be that if a test is failing, it's +hard to see for which parameters. To avoid this problem, ensure that: + + - No computation related to the features tested is done in the + ``test_*`` generator function, but delegated to a corresponding + ``check_*`` function (can be inside the generator, to share namespace). + - The generators are used *solely* for loops over parameters. + - These parameters are *not* arrays. + .. warning:: Parametric tests cannot be implemented on classes derived from |