Exemplo n.º 1
0
 def _do_test(self, content, expected):
     e = [
         deepcopy(i) for i in NewickEventFactory(tokenizer=NewickTokenizer(
             stream=StringIO(content)))
     ]
     # print(e)
     self.assertEqual(e, expected)
Exemplo n.º 2
0
def parse_newick(newick=None,
                 stream=None,
                 filepath=None,
                 _class=TreeWithPathsInEdges):
    from peyotl.utility.tokenizer import NewickEventFactory, NewickTokenizer
    nt = NewickTokenizer(stream=stream, newick=newick, filepath=filepath)
    nef = NewickEventFactory(tokenizer=nt)
    return _class(newick_events=nef)
Exemplo n.º 3
0
 def testOddQuotes(self):
     content = "((h_ ,'p)h p,g()[],:_)hpg;"
     tok = NewickTokenizer(StringIO(content))
     content = "((h_ ,'p')h p,'g()[]',:_')hpg;"
     tok = NewickTokenizer(StringIO(content))
     self.assertRaises(Exception, tok.tokens)
Exemplo n.º 4
0
 def _do_test(self, content, expected):
     self.assertEqual([i for i in NewickTokenizer(StringIO(content))],
                      expected)