Skip to content

Commit

Permalink
DOC: add details on how to use generator tests to documentation.
Browse files Browse the repository at this point in the history
Thanks to Pauli Virtanen for this useful suggestion.
  • Loading branch information
rgommers committed Jul 15, 2012
1 parent f9c6867 commit 23dba57
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions doc/TESTS.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 23dba57

Please sign in to comment.