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

Method test13f_copyRootRecursive

tables/tests/test_basics.py:948–972  ·  view source on GitHub ↗

Recursively copying the root group into a group in another file.

(self)

Source from the content-addressed store, hash-verified

946 Path(h5fname2).unlink()
947
948 def test13f_copyRootRecursive(self):
949 """Recursively copying the root group into a group in another file."""
950
951 self._reopen(mode="r+", node_cache_slots=self.node_cache_slots)
952 h5fname2 = tempfile.mktemp(".h5")
953 h5file2 = tb.open_file(
954 h5fname2, mode="w", node_cache_slots=self.node_cache_slots
955 )
956 try:
957 h5file2.create_group("/", "agroup2")
958
959 # fileh.root => h5file2.root.agroup2
960 new_node = self.h5file.copy_node(
961 self.h5file.root, h5file2.root.agroup2, recursive=True
962 )
963 dstNode = h5file2.root.agroup2
964
965 self.assertIs(new_node, dstNode)
966 self.assertIn("/agroup2/agroup", h5file2)
967 self.assertIn("/agroup2/agroup/anarray1", h5file2)
968 self.assertIn("/agroup2/agroup/agroup3", h5file2)
969
970 finally:
971 h5file2.close()
972 Path(h5fname2).unlink()
973
974 def test13g_copyRootItself(self):
975 """Recursively copying the root group into itself."""

Callers

nothing calls this directly

Calls 4

create_groupMethod · 0.80
copy_nodeMethod · 0.80
_reopenMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected