MCPcopy Create free account
hub / github.com/PyTables/PyTables / test03_copyChildren

Method test03_copyChildren

tables/tests/test_do_undo.py:2187–2216  ·  view source on GitHub ↗

Copying the children of a group

(self)

Source from the content-addressed store, hash-verified

2185 self.assertIs(self.h5file.root.agroup, new_node)
2186
2187 def test03_copyChildren(self):
2188 """Copying the children of a group"""
2189
2190 if common.verbose:
2191 print("\n", "-=" * 30)
2192 print(
2193 "Running %s.test03_copyChildren..." % self.__class__.__name__
2194 )
2195
2196 # Enable undo/redo.
2197 self.h5file.enable_undo()
2198
2199 # /agroup/* => /agroup/
2200 self.h5file.copy_children("/agroup", "/agroup2", recursive=True)
2201
2202 # Undo the copy.
2203 self.h5file.undo()
2204
2205 # Check that the copied nodes do not exist in the object tree.
2206 self.assertNotIn("/agroup2/anarray1", self.h5file)
2207 self.assertNotIn("/agroup2/anarray2", self.h5file)
2208 self.assertNotIn("/agroup2/agroup3", self.h5file)
2209
2210 # Redo the copy.
2211 self.h5file.redo()
2212
2213 # Check that the copied nodes exist again in the object tree.
2214 self.assertIn("/agroup2/anarray1", self.h5file)
2215 self.assertIn("/agroup2/anarray2", self.h5file)
2216 self.assertIn("/agroup2/agroup3", self.h5file)
2217
2218
2219class ComplexTestCase(common.TempFileMixin, common.PyTablesTestCase):

Callers

nothing calls this directly

Calls 4

enable_undoMethod · 0.80
undoMethod · 0.80
redoMethod · 0.80
copy_childrenMethod · 0.45

Tested by

no test coverage detected