[Biopython-dev] test_PhyloXML.py on Python 3
Peter
biopython at maubp.freeserve.co.uk
Fri Aug 13 10:29:23 UTC 2010
On Fri, Aug 13, 2010 at 2:24 AM, Eric Talevich <eric.talevich at gmail.com> wrote:
> On Thu, Aug 12, 2010 at 12:37 PM, Peter <biopython at maubp.freeserve.co.uk>wrote:
>
>> Hi Eric (et al),
>>
>> Is test_PhyloXML.py working for you under Python 3?
>>
>> I'm getting the following (both with and without the 2to3 --nofix=long
>> option):
>>
>> $ python3 test_PhyloXML.py
>> ...
>> File "/home/xxx/lib/python3.1/site-packages/Bio/Phylo/PhyloXMLIO.py",
>> line 298, in __init__
>> event, root = next(context)
>> File "<string>", line 59, in __iter__
>> TypeError: invalid event tuple
>>
>> ----------------------------------------------------------------------
>> Ran 47 tests in 0.015s
>>
>> All the sub-tests in test_PhyloXML.py are failing the same way.
>>
>> >From memory this was working recently.
>>
>>
> Yeah, it was... it's fixed now/again.
>
> This is the issue with passing byte/unicode strings to cElementTree in
> Python 3. I had a check for Python versions 3.0.0 through 3.1.1, where we
> need to import ElementTree instead of cElementTree. Apparently Python 3.1.2
> still has the bug.
>
> -Eric
Yep - much better. However, I'm still seeing four failures with Python 3.1.2
which appear to be related to float/int/long conversion:
ERROR: test_made (__main__.WriterTests)
Round-trip parsing and serialization of made_up.xml.
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_PhyloXML.py", line 550, in test_made
(TreeTests, ['test_Confidence', 'test_Polygon']),
File "test_PhyloXML.py", line 512, in _rewrite_and_call
getattr(inst, test)()
File "test_PhyloXML.py", line 360, in test_Polygon
tree = PhyloXMLIO.read(EX_MADE).phylogenies[1]
File "/home/xxx/lib/python3.1/site-packages/Bio/Phylo/PhyloXMLIO.py",
line 105, in read
return Parser(file).read()
File "/home/xxx/lib/python3.1/site-packages/Bio/Phylo/PhyloXMLIO.py",
line 314, in read
phylogeny = self._parse_phylogeny(elem)
File "/home/xxx/lib/python3.1/site-packages/Bio/Phylo/PhyloXMLIO.py",
line 356, in _parse_phylogeny
phylogeny.root = self._parse_clade(elem)
File "/home/xxx/lib/python3.1/site-packages/Bio/Phylo/PhyloXMLIO.py",
line 402, in _parse_clade
clade.clades.append(self._parse_clade(elem))
File "/home/xxx/lib/python3.1/site-packages/Bio/Phylo/PhyloXMLIO.py",
line 422, in _parse_clade
getattr(self, tag)(elem))
File "/home/xxx/lib/python3.1/site-packages/Bio/Phylo/PhyloXMLIO.py",
line 553, in distribution
polygons=_get_children_as(elem, 'polygon', self.polygon))
File "/home/xxx/lib/python3.1/site-packages/Bio/Phylo/PhyloXMLIO.py",
line 195, in _get_children_as
parent.findall(_ns(tag))]
File "/home/xxx/lib/python3.1/site-packages/Bio/Phylo/PhyloXMLIO.py",
line 194, in <listcomp>
return [construct(child) for child in
File "/home/xxx/lib/python3.1/site-packages/Bio/Phylo/PhyloXMLIO.py",
line 595, in polygon
points=_get_children_as(elem, 'point', self.point))
File "/home/xxx/lib/python3.1/site-packages/Bio/Phylo/PhyloXMLIO.py",
line 195, in _get_children_as
parent.findall(_ns(tag))]
File "/home/xxx/lib/python3.1/site-packages/Bio/Phylo/PhyloXMLIO.py",
line 194, in <listcomp>
return [construct(child) for child in
File "/home/xxx/lib/python3.1/site-packages/Bio/Phylo/PhyloXMLIO.py",
line 589, in point
_get_child_text(elem, 'long', float),
File "/home/xxx/lib/python3.1/site-packages/Bio/Phylo/PhyloXMLIO.py",
line 187, in _get_child_text
return construct(child.text)
ValueError: could not convert string to float: <class 'int'>
======================================================================
ERROR: test_phylo (__main__.WriterTests)
Round-trip parsing and serialization of phyloxml_examples.xml.
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_PhyloXML.py", line 571, in test_phylo
'test_Taxonomy', 'test_Uri',
File "test_PhyloXML.py", line 512, in _rewrite_and_call
getattr(inst, test)()
File "test_PhyloXML.py", line 176, in test_Phyloxml
phx = PhyloXMLIO.read(EX_PHYLO)
File "/home/xxx/lib/python3.1/site-packages/Bio/Phylo/PhyloXMLIO.py",
line 105, in read
return Parser(file).read()
File "/home/xxx/lib/python3.1/site-packages/Bio/Phylo/PhyloXMLIO.py",
line 314, in read
phylogeny = self._parse_phylogeny(elem)
File "/home/xxx/lib/python3.1/site-packages/Bio/Phylo/PhyloXMLIO.py",
line 356, in _parse_phylogeny
phylogeny.root = self._parse_clade(elem)
File "/home/xxx/lib/python3.1/site-packages/Bio/Phylo/PhyloXMLIO.py",
line 402, in _parse_clade
clade.clades.append(self._parse_clade(elem))
File "/home/xxx/lib/python3.1/site-packages/Bio/Phylo/PhyloXMLIO.py",
line 402, in _parse_clade
clade.clades.append(self._parse_clade(elem))
File "/home/xxx/lib/python3.1/site-packages/Bio/Phylo/PhyloXMLIO.py",
line 422, in _parse_clade
getattr(self, tag)(elem))
File "/home/xxx/lib/python3.1/site-packages/Bio/Phylo/PhyloXMLIO.py",
line 552, in distribution
points=_get_children_as(elem, 'point', self.point),
File "/home/xxx/lib/python3.1/site-packages/Bio/Phylo/PhyloXMLIO.py",
line 195, in _get_children_as
parent.findall(_ns(tag))]
File "/home/xxx/lib/python3.1/site-packages/Bio/Phylo/PhyloXMLIO.py",
line 194, in <listcomp>
return [construct(child) for child in
File "/home/xxx/lib/python3.1/site-packages/Bio/Phylo/PhyloXMLIO.py",
line 589, in point
_get_child_text(elem, 'long', float),
File "/home/xxx/lib/python3.1/site-packages/Bio/Phylo/PhyloXMLIO.py",
line 187, in _get_child_text
return construct(child.text)
ValueError: could not convert string to float: <class 'int'>
======================================================================
FAIL: test_Distribution (__main__.TreeTests)
Instantiation of Distribution objects.
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_PhyloXML.py", line 322, in test_Distribution
self.assertEqual(point.long, longi)
AssertionError: <class 'int'> != 8.769303
======================================================================
FAIL: test_Polygon (__main__.TreeTests)
Instantiation of Polygon objects.
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_PhyloXML.py", line 378, in test_Polygon
self.assertEqual(point.long, longi)
AssertionError: <class 'int'> != 8.769303
----------------------------------------------------------------------
More information about the Biopython-dev
mailing list