[Biopython-dev] tabs in doctest results?
Vincent Davis
vincent at vincentdavis.net
Tue Dec 8 03:12:01 UTC 2015
On Fri, Dec 4, 2015 at 2:32 PM, Peter Cock <p.j.a.cock at googlemail.com>
wrote:
> When you have potentially escaped characters in a doctest,
> you may have to make the entire docstring a raw string, i.e.
>
> r"""The first line
>
> More text here including the doctest.
> """
>
> See for example the format method in Bio/SeqRecord.py where
> we do this to handle a new line character.
>
> Another option here could be to change the code to produce
> space aligned __str__ output? Ask Eric first though.
>
Just an FYI,
doctest has an option NORMALIZE_WHITESPACE
https://docs.python.org/3.5/library/doctest.html#doctest.NORMALIZE_WHITESPACE
"
When specified, all sequences of whitespace (blanks and newlines) are
treated as equal. Any sequence of whitespace within the expected output
will match any sequence of whitespace within the actual output. By default,
whitespace must match exactly. NORMALIZE_WHITESPACE
<https://docs.python.org/3.5/library/doctest.html#doctest.NORMALIZE_WHITESPACE>
is
especially useful when a line of expected output is very long, and you want
to wrap it across multiple lines in your source.
"
Vincent Davis
720-301-3003
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.open-bio.org/pipermail/biopython-dev/attachments/20151207/a3ea7ed5/attachment-0001.html>
More information about the Biopython-dev
mailing list