[Biopython-dev] 2to3 and doctests

Peter biopython at maubp.freeserve.co.uk
Sun Jul 11 05:42:24 EDT 2010


2010/7/10 Tiago Antão <tiagoantao at gmail.com>:
> Hi,
>
> There are a couple of issues with 2to3 and biopython doctests.
>
> 1. There is a bug in 2to3 which crashes the tool with some doctests.
> This bug was recognized by the python team and corrected (but only on
> svn).
> It is very easy solve, in file refactor.py (lib2to2 python library) replace
> if self.log.isEnabledFor(logging.DEBUG):
> with
> if self.logger.isEnabledFor(logging.DEBUG):
> See
> http://svn.python.org/view/sandbox/trunk/2to3/lib2to3/refactor.py?r1=81478&r2=82779
> And
> http://bugs.python.org/issue9217
> This affects probably all versions of 2to3 (2.6.5 to 3.1.2)

Thanks for the alert & links

> 2. Some of our doctests are incorrectly specified, one example from
> Phylo/BaseTree.py
>        >>> for clade in tree.find_clades(branch_length=True, order='level'):
>        >>>     if (clade.branch_length < .5 and
>        >>>         not clade.is_terminal() and
>        >>>         clade is not self.root):
>        >>>         tree.collapse(clade)
> According to documentation we are supposed to use “...” on
> continuation lines, not “>>>”.
> See http://bugs.python.org/issue9221
> 2to3 seems to be more sensitive to this than python when running the tests.
>
> If nobody opposes, I will convert all doctests to correct variations

Yes, those >>> should be ... so please go ahead and fix them.

Thanks,

Peter



More information about the Biopython-dev mailing list