Skip to content

Commit

Permalink
Adding additional Newick test file with quoted node labels and node c…
Browse files Browse the repository at this point in the history
…omments.
  • Loading branch information
bendmorris authored and etal committed Feb 10, 2013
1 parent 3443add commit 86a1ce8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions Tests/Nexus/test.new
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1 @@
((((((((((('Bos taurus',('Gazella dorcas',(('Capra hircus','Capra ibex')))),('Cervus elaphus',(('Rangifer tarandus','Odocoileus hemionus'),'Alces alces')))),'Sus scrofa'),('Camelus dromedarius','Lama glama')),'Equus caballus'[wild horse; also 'Equus ferus caballus']),('Canis lupus',(((((('Halichoerus grypus','Phoca groenlandica'),'Cystophora cristata'),'Erignathus barbatus'),(('Callorhinus ursinus','Arctocephalus australis'))),(('Mustela vison','Mephitis mephitis'))),('Ursus americanus'[American black bear],'Ursus arctos'[brown bear])))),'Phyllostomus hastatus'),('Homo sapiens'[modern human],((('Cavia porcellus',(('Rattus norvegicus'[brown rat],'Mus musculus'[house mouse])))),('Oryctolagus cuniculus','Lepus europaeus'))))),(('Macropus eugenii','Bettongia penicillata'),'Pseudocheirus peregrinus'))[100];
7 changes: 7 additions & 0 deletions Tests/test_Phylo.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@


# Example Newick and Nexus files # Example Newick and Nexus files
EX_NEWICK = 'Nexus/int_node_labels.nwk' EX_NEWICK = 'Nexus/int_node_labels.nwk'
EX_NEWICK2 = 'Nexus/test.new'
EX_NEXUS = 'Nexus/test_Nexus_input.nex' EX_NEXUS = 'Nexus/test_Nexus_input.nex'


# Example PhyloXML files # Example PhyloXML files
Expand All @@ -30,6 +31,12 @@ def test_newick_read_single(self):
"""Read a Newick file with one tree.""" """Read a Newick file with one tree."""
tree = Phylo.read(EX_NEWICK, 'newick') tree = Phylo.read(EX_NEWICK, 'newick')
self.assertEqual(len(tree.get_terminals()), 28) self.assertEqual(len(tree.get_terminals()), 28)

tree = Phylo.read(EX_NEWICK2, 'newick')
self.assertEqual(len(tree.get_terminals()), 33)
self.assertEqual(tree.find_any('Homo sapiens').comment, 'modern human')
self.assertEqual(tree.find_any('Equus caballus').comment, "wild horse; also 'Equus ferus caballus'")
self.assertEqual(tree.root.confidence, 1.0)


def test_newick_read_multiple(self): def test_newick_read_multiple(self):
"""Parse a Nexus file with multiple trees.""" """Parse a Nexus file with multiple trees."""
Expand Down

0 comments on commit 86a1ce8

Please sign in to comment.