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

Method test13e_copyRootRecursive

tables/tests/test_basics.py:924–946  ·  view source on GitHub ↗

Recursively copying the root group into the root of another file.

(self)

Source from the content-addressed store, hash-verified

922 self.assertIsNotNone(dstChild3)
923
924 def test13e_copyRootRecursive(self):
925 """Recursively copying the root group into the root of another file."""
926
927 self._reopen(mode="r+", node_cache_slots=self.node_cache_slots)
928 h5fname2 = tempfile.mktemp(".h5")
929 h5file2 = tb.open_file(
930 h5fname2, mode="w", node_cache_slots=self.node_cache_slots
931 )
932 try:
933 # h5file.root => h5file2.root
934 new_node = self.h5file.copy_node(
935 self.h5file.root, h5file2.root, recursive=True
936 )
937 dstNode = h5file2.root
938
939 self.assertIs(new_node, dstNode)
940 self.assertIn("/agroup", h5file2)
941 self.assertIn("/agroup/anarray1", h5file2)
942 self.assertIn("/agroup/agroup3", h5file2)
943
944 finally:
945 h5file2.close()
946 Path(h5fname2).unlink()
947
948 def test13f_copyRootRecursive(self):
949 """Recursively copying the root group into a group in another file."""

Callers

nothing calls this directly

Calls 3

copy_nodeMethod · 0.80
_reopenMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected