コード例 #1
0
 def test_remove(self):
     n = Node()
     n['a'] = 1
     n['b'] = 2
     n['c'] = 3
     self.assertEqual(n.number_of_children(),3)
     n.remove(path='c')
     self.assertEqual(n.number_of_children(),2)
     paths = n.paths()
     for v in ['a','b']:
         self.assertTrue(v in paths)
     n.remove(index=0)
     paths = n.paths()
     for v in ['b']:
         self.assertTrue(v in paths)
コード例 #2
0
 def test_paths(self):
     n = Node()
     n['a'] = 1
     n['b'] = 2
     n['c'] = 3
     for v in ['a','b','c']:
         self.assertTrue(n.has_path(v))
     paths = n.paths()
     for v in ['a','b','c']:
         self.assertTrue(v in paths)