[TIP] Doctest or unitest?
constant.beta at gmail.com
Mon Mar 5 13:49:44 PST 2007
On 3/5/07, Andrew Bennetts <andrew-tip at puzzling.org> wrote:
> - It's harder to name and talk about a specific failing test case when your
> test case is example 27, about, oh, half-way down foo-feature.txt, compared
> to "FooTestCase.test_feature_with_all_knobs_turned_off". This is
> frustrating when communicating with fellow developers about a test failure,
> and is exacerbated by the lack of correlation between reported line numbers
> in errors and actual line numbers in the file. (This also mildly irritating
> when trying to run just the failing test for purposes of debugging and
> fixing the failure.)
Just want to point out that this is only a limitation of a test
runner, not the doctest format itself. I can imagine a nose plugin
(hint hint ;) that can use some kind of convention to name and
separate test cases.
Returns 42 by default.
Returns 7 for 6.
doctest:answer():"Returns 42 by default."
doctest:answer():"Returns 7 for 6."
or something similar.
More information about the testing-in-python