def test_exclude_vars(self): import ncobj.grouping as og for var in og.walk_group_objects(self.nco, ncobj.Variable): print print var if var.name in ("exc_1", "exc_2"): var.remove() print print "new result:" print "\n".join(str(x) for x in og.walk_group_objects(self.nco))
def test_basic(self): walk_objs = list(walk_group_objects(self.root)) # NOTE: can't use set-equality here, as it test 'is' not '__eq__'. for elem in self.all_objs: self.assertIn(elem, walk_objs) for obj in walk_objs: self.assertIn(obj, self.all_objs)