Back to index

python-biopython  1.60
Classes | Functions | Variables
test_PhyloXML Namespace Reference

Classes

class  ParseTests
class  TreeTests
class  WriterTests
class  MethodTests

Functions

def _test_read_factory
def _test_parse_factory
def _test_shape_factory

Variables

string EX_APAF = 'PhyloXML/apaf.xml'
string EX_BCL2 = 'PhyloXML/bcl_2.xml'
string EX_MADE = 'PhyloXML/made_up.xml'
string EX_PHYLO = 'PhyloXML/phyloxml_examples.xml'
string EX_DOLLO = 'PhyloXML/o_tol_332_d_dollo.xml'
tuple DUMMY = tempfile.mktemp()
tuple runner = unittest.TextTestRunner(verbosity=2)

Function Documentation

def test_PhyloXML._test_parse_factory (   source,
  count 
) [private]
Generate a test method for parse()ing the given source.

The generated function extracts each phylogenetic tree using the parse()
function and counts the total number of trees extracted.

Definition at line 51 of file test_PhyloXML.py.

00051 
00052 def _test_parse_factory(source, count):
00053     """Generate a test method for parse()ing the given source.
00054 
00055     The generated function extracts each phylogenetic tree using the parse()
00056     function and counts the total number of trees extracted.
00057     """
00058     fname = os.path.basename(source)
00059     def test_parse(self):
00060         trees = PhyloXMLIO.parse(source)
00061         self.assertEqual(len(list(trees)), count)
00062     test_parse.__doc__ = "Parse the phylogenies in %s." % fname
00063     return test_parse
00064 

def test_PhyloXML._test_read_factory (   source,
  count 
) [private]
Generate a test method for read()ing the given source.

The generated function reads an example file to produce a phyloXML object,
then tests for existence of the root node, and counts the number of
phylogenies under the root.

Definition at line 34 of file test_PhyloXML.py.

00034 
00035 def _test_read_factory(source, count):
00036     """Generate a test method for read()ing the given source.
00037 
00038     The generated function reads an example file to produce a phyloXML object,
00039     then tests for existence of the root node, and counts the number of
00040     phylogenies under the root.
00041     """
00042     fname = os.path.basename(source)
00043     def test_read(self):
00044         phx = PhyloXMLIO.read(source)
00045         self.assertTrue(phx)
00046         self.assertEqual(len(phx), count[0])
00047         self.assertEqual(len(phx.other), count[1])
00048     test_read.__doc__ = "Read %s to produce a phyloXML object." % fname
00049     return test_read
00050 

def test_PhyloXML._test_shape_factory (   source,
  shapes 
) [private]
Generate a test method for checking tree shapes.

Counts the branches at each level of branching in a phylogenetic tree, 3
clades deep.

Definition at line 65 of file test_PhyloXML.py.

00065 
00066 def _test_shape_factory(source, shapes):
00067     """Generate a test method for checking tree shapes.
00068 
00069     Counts the branches at each level of branching in a phylogenetic tree, 3
00070     clades deep.
00071     """
00072     fname = os.path.basename(source)
00073     def test_shape(self):
00074         trees = PhyloXMLIO.parse(source)
00075         for tree, shape_expect in zip(trees, shapes):
00076             self.assertEqual(len(tree.clade), len(shape_expect))
00077             for clade, sub_expect in zip(tree.clade, shape_expect):
00078                 self.assertEqual(len(clade), sub_expect[0])
00079                 for subclade, len_expect in zip(clade, sub_expect[1]):
00080                     self.assertEqual(len(subclade), len_expect)
00081     test_shape.__doc__ = "Check the branching structure of %s." % fname
00082     return test_shape
00083 


Variable Documentation

tuple test_PhyloXML.DUMMY = tempfile.mktemp()

Definition at line 28 of file test_PhyloXML.py.

string test_PhyloXML.EX_APAF = 'PhyloXML/apaf.xml'

Definition at line 21 of file test_PhyloXML.py.

string test_PhyloXML.EX_BCL2 = 'PhyloXML/bcl_2.xml'

Definition at line 22 of file test_PhyloXML.py.

string test_PhyloXML.EX_DOLLO = 'PhyloXML/o_tol_332_d_dollo.xml'

Definition at line 25 of file test_PhyloXML.py.

string test_PhyloXML.EX_MADE = 'PhyloXML/made_up.xml'

Definition at line 23 of file test_PhyloXML.py.

string test_PhyloXML.EX_PHYLO = 'PhyloXML/phyloxml_examples.xml'

Definition at line 24 of file test_PhyloXML.py.

tuple test_PhyloXML.runner = unittest.TextTestRunner(verbosity=2)

Definition at line 745 of file test_PhyloXML.py.