We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2ccbeef commit 9548acaCopy full SHA for 9548aca
1 file changed
source-code/testing/Unittest/Newick/node_utils.py
@@ -1,18 +1,17 @@
1
#!/usr/bin/env python
2
'''module containing various functions for working with trees and nodes'''
3
4
-from node_parser import NodeParser
5
import unittest
+from node_parser import NodeParser
6
7
8
def depth(node):
9
'''compute the depth of the given tree'''
10
if node is None:
11
return 0
12
- elif node.is_leaf():
+ if node.is_leaf():
13
return 1
14
- else:
15
- return 1 + max(list(map(depth, node.children())))
+ return 1 + max(list(map(depth, node.children())))
16
17
18
def depth_first_iterator(node):
@@ -131,5 +130,6 @@ def test_deep_tree(self):
131
130
tree = parser.node()
132
self.assertEqual(nr_leaf_nodes(tree), 1)
133
+
134
if __name__ == '__main__':
135
unittest.main()
0 commit comments