diff options
Diffstat (limited to 'test/test_tree.py')
-rw-r--r-- | test/test_tree.py | 45 |
1 files changed, 34 insertions, 11 deletions
diff --git a/test/test_tree.py b/test/test_tree.py index 58a8ba9..0faf079 100644 --- a/test/test_tree.py +++ b/test/test_tree.py @@ -21,7 +21,14 @@ squeleton generated by /home/syt/bin/py2tests on Jan 20 at 10:43:25 """ from logilab.common.testlib import TestCase, unittest_main -from logilab.common.tree import * +from logilab.common.tree import ( + Node, + NodeNotFound, + post_order_list, + PostfixedDepthFirstIterator, + pre_order_list, + PrefixedDepthFirstIterator, +) tree = ( "root", @@ -196,9 +203,17 @@ class post_order_list_FunctionTest(TestCase): create a list with tree nodes for which the <filter> function returned true in a post order foashion """ - L = ["child_2_1", "child_3_1", "child_2_2", "child_1_1", "child_2_3", "child_1_2", "root"] - l = [n.id for n in post_order_list(self.o)] - self.assertEqual(l, L, l) + L = [ + "child_2_1", + "child_3_1", + "child_2_2", + "child_1_1", + "child_2_3", + "child_1_2", + "root", + ] + li = [n.id for n in post_order_list(self.o)] + self.assertEqual(li, L, li) def test_known_values_post_order_list2(self): """ @@ -212,8 +227,8 @@ class post_order_list_FunctionTest(TestCase): return 1 L = ["child_2_1", "child_1_1", "child_2_3", "child_1_2", "root"] - l = [n.id for n in post_order_list(self.o, filter)] - self.assertEqual(l, L, l) + li = [n.id for n in post_order_list(self.o, filter)] + self.assertEqual(li, L, li) class PostfixedDepthFirstIterator_ClassTest(TestCase): @@ -246,9 +261,17 @@ class pre_order_list_FunctionTest(TestCase): create a list with tree nodes for which the <filter> function returned true in a pre order fashion """ - L = ["root", "child_1_1", "child_2_1", "child_2_2", "child_3_1", "child_1_2", "child_2_3"] - l = [n.id for n in pre_order_list(self.o)] - self.assertEqual(l, L, l) + L = [ + "root", + "child_1_1", + "child_2_1", + "child_2_2", + "child_3_1", + "child_1_2", + "child_2_3", + ] + li = [n.id for n in pre_order_list(self.o)] + self.assertEqual(li, L, li) def test_known_values_pre_order_list2(self): """ @@ -262,8 +285,8 @@ class pre_order_list_FunctionTest(TestCase): return 1 L = ["root", "child_1_1", "child_2_1", "child_1_2", "child_2_3"] - l = [n.id for n in pre_order_list(self.o, filter)] - self.assertEqual(l, L, l) + li = [n.id for n in pre_order_list(self.o, filter)] + self.assertEqual(li, L, li) class PrefixedDepthFirstIterator_ClassTest(TestCase): |