Sometimes, the default behavior of doctest
makes writing a particular test inconvenient. For example, doctest
might look at a trivial difference between the expected and real outputs and wrongly conclude that the test has failed. This is where doctest
directives come to the rescue. Directives are specially formatted comments that you can place after the source code of a test and that tell doctest
to alter its default behavior in some way.
A directive comment begins with # doctest:
, after which comes a comma-separated list of options that either enable or disable various behaviors. To enable a behavior, write a +
(plus symbol) followed by the behavior name. To disable a behavior, white a –
(minus symbol) followed by the behavior name. We'll take a look at the several directives in the following sections.
3.142.199.181