On some occasions, doctest
will recognize some text as an example to be checked, when in truth you want it to be simply text. This situation is rarer than it might at first seem, because usually there's no harm in letting doctest
check everything it can. In fact, usually it's very helpful to have doctest
check everything it can. For those times when you want to limit what doctest
checks, though, there's the +SKIP
directive.
Append the following code to your doctest file:
Now we're telling doctest to skip a test >>> 'This test would fail.' # doctest: +SKIP If it were allowed to run.
Before we added this last example to the file, doctest
reported thirteen tests when we ran the file through it. After adding this code, doctest
still reports thirteen tests. Adding the skip directive to the code completely removed it from consideration by doctest. It's not a test that passes, nor a test that fails. It's not a test at all.
18.191.189.186