[Biopython-dev] 2to3 and doctests

Tiago Antão tiagoantao at gmail.com
Sat Jul 10 20:42:00 UTC 2010


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)

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



-- 
"If you want to get laid, go to college.  If you want an education, go
to the library." - Frank Zappa




More information about the Biopython-dev mailing list