Browse files

Adding additional Newick test file with quoted node labels and node c…

…omments.
  • Loading branch information...
1 parent 3443add commit 86a1ce87dda895929fa8b20542ddf5debf9a7ced @bendmorris bendmorris committed with etal Feb 10, 2013
Showing with 8 additions and 0 deletions.
  1. +1 −0 Tests/Nexus/test.new
  2. +7 −0 Tests/test_Phylo.py
View
1 Tests/Nexus/test.new
@@ -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];
View
7 Tests/test_Phylo.py
@@ -15,6 +15,7 @@
# Example Newick and Nexus files
EX_NEWICK = 'Nexus/int_node_labels.nwk'
+EX_NEWICK2 = 'Nexus/test.new'
EX_NEXUS = 'Nexus/test_Nexus_input.nex'
# Example PhyloXML files
@@ -30,6 +31,12 @@ def test_newick_read_single(self):
"""Read a Newick file with one tree."""
tree = Phylo.read(EX_NEWICK, 'newick')
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):
"""Parse a Nexus file with multiple trees."""

0 comments on commit 86a1ce8

Please sign in to comment.