Recursively copying the root group into a group in another file.
(self)
| 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.""" |
nothing calls this directly
no test coverage detected