def _test_shape_factory(source, shapes):
 fname = os.path.basename(source)
 def test_shape(self):
  trees = PhyloXMLIO.parse(source)
  for (tree, shape_expect) in zip(trees, shapes):
   self.assertEqual(len(tree.clade), len(shape_expect))
   for (clade, sub_expect) in zip(tree.clade, shape_expect):
    self.assertEqual(len(clade), sub_expect[0])
    for (subclade, len_expect) in zip(clade, sub_expect[1]):
     self.assertEqual(len(subclade), len_expect)
 test_shape.__doc__ = ('Check the branching structure of %s.' % fname)
 return test_shape

def _test_shape_factory ( source , shapes ) : fname = os . path . basename ( source ) def test_shape ( self ) : trees = PhyloXMLIO . parse ( source ) for ( tree , shape_expect ) in zip ( trees , shapes ) : self . assertEqual ( len ( tree . clade ) , len ( shape_expect ) ) for ( clade , sub_expect ) in zip ( tree . clade , shape_expect ) : self . assertEqual ( len ( clade ) , sub_expect [ 0 ] ) for ( subclade , len_expect ) in zip ( clade , sub_expect [ 1 ] ) : self . assertEqual ( len ( subclade ) , len_expect ) test_shape . __doc__ = ( 'Check the branching structure of %s.' % fname ) return test_shape
generate a test method for checking tree shapes .