Beispiel #1
0
 def test_stepping_backward(self):
     tree = self.basic_tree
     node = tree.root
     for name in (str(i).zfill(2) for i in range(10, 0, -1)): # 10 ... 01 (inclusive)
         node = step(tree, node, dir='back')
         self.assertEqual(node.name, name)
     self.assertTrue(step(tree, node, dir='back') is None)
Beispiel #2
0
 def test_stepping_forward(self):
     tree = self.basic_tree
     node = tree.root
     for name in (str(i).zfill(2) for i in range(1, 11)): # 01 ... 10 (inclusive)
         node = step(tree, node)
         self.assertEqual(node.name, name)
     self.assertTrue(step(tree, node) is None)
Beispiel #3
0
 def get_prev_next(tree, node, steps, dir='next'):
     result = []
     node = step(tree, node, dir)
     for i in range(steps):
         if node is None: break
         result.append(node)
         node = step(tree, node, dir)
     return result