[Biopython-dev] tabs in doctest results?
Peter Cock
p.j.a.cock at googlemail.com
Fri Dec 4 21:32:13 UTC 2015
Hi Vincent,
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.
Peter
On Fri, Dec 4, 2015 at 5:20 PM, Vincent Davis <vincent at vincentdavis.net> wrote:
> I am working on the doctests in TreeConstructor.py.
> for example in this doctest
> https://github.com/biopython/biopython/blob/master/Bio/Phylo/TreeConstruction.py#L353
> I can't get the test to accept the output. Even when the Expect looks the
> same as the Got.
> I am think this might be related to "All hard tab characters are expanded to
> spaces"(python docs) and it looks like the output uses spaces.
> https://github.com/biopython/biopython/blob/master/Bio/Phylo/TreeConstruction.py#L291
> And in fact I can fix my problem if I replace the \t with 4 spaces in the
> above __str__
>
> Recommendations as to how to fix this?
>
> Vincent Davis
> 720-301-3003
>
> _______________________________________________
> Biopython-dev mailing list
> Biopython-dev at mailman.open-bio.org
> http://mailman.open-bio.org/mailman/listinfo/biopython-dev
More information about the Biopython-dev
mailing list