Example #1
0
 def test_origin_from_path_returns_relative_to_root_if_path_starts_with_slash(self):
     root = Tree('root')
     child = Tree('child')
     root.add_child(child)
     node, parts = child._origin_from_path('/root/child')
     self.assertEqual(root, node)
     self.assertEqual(['child'], parts)
Example #2
0
 def test_origin_from_path_returns_relative_to_current_node_if_path_does_not_start_with_slash(self):
     root = Tree('root')
     child1 = Tree('child1')
     child2 = Tree('child2')
     root.add_child(child1)
     child1.add_child(child2)
     node, parts = child1._origin_from_path('child2')
     self.assertEqual(child1, node)
     self.assertEqual(['child2'], parts)