File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
source-code/testing/Unittest/Newick Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env python
2
2
'''module containing various functions for working with trees and nodes'''
3
3
4
- from node_parser import NodeParser
5
4
import unittest
5
+ from node_parser import NodeParser
6
6
7
7
8
8
def depth (node ):
9
9
'''compute the depth of the given tree'''
10
10
if node is None :
11
11
return 0
12
- elif node .is_leaf ():
12
+ if node .is_leaf ():
13
13
return 1
14
- else :
15
- return 1 + max (list (map (depth , node .children ())))
14
+ return 1 + max (list (map (depth , node .children ())))
16
15
17
16
18
17
def depth_first_iterator (node ):
@@ -131,5 +130,6 @@ def test_deep_tree(self):
131
130
tree = parser .node ()
132
131
self .assertEqual (nr_leaf_nodes (tree ), 1 )
133
132
133
+
134
134
if __name__ == '__main__' :
135
135
unittest .main ()
You can’t perform that action at this time.
0 commit comments