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

Method test09_renameGroup

tables/tests/test_basics.py:484–510  ·  view source on GitHub ↗

Checking renaming a Group and access it after a close/open.

(self)

Source from the content-addressed store, hash-verified

482 self.h5file.rename_node(self.h5file.root.anarray, "array 2")
483
484 def test09_renameGroup(self):
485 """Checking renaming a Group and access it after a close/open."""
486
487 self._reopen(mode="r+", node_cache_slots=self.node_cache_slots)
488 self.h5file.rename_node(self.h5file.root.agroup, "agroup3")
489
490 # Open this file in read-only mode
491 self._reopen(node_cache_slots=self.node_cache_slots)
492
493 # Ensure that the new name exists
494 group = self.h5file.root.agroup3
495 self.assertEqual(group._v_name, "agroup3")
496 self.assertEqual(group._v_pathname, "/agroup3")
497
498 # The children of this group also must be accessible through the
499 # new name path
500 group2 = self.h5file.get_node("/agroup3/agroup3")
501 self.assertEqual(group2._v_name, "agroup3")
502 self.assertEqual(group2._v_pathname, "/agroup3/agroup3")
503
504 # Try to get the previous object with the old name
505 with self.assertRaises(LookupError):
506 self.h5file.root.agroup
507
508 # Try to get a child with the old pathname
509 with self.assertRaises(LookupError):
510 self.h5file.get_node("/agroup/agroup3")
511
512 def test09b_renameGroup(self):
513 """Checking renaming a Group and access it immediately."""

Callers

nothing calls this directly

Calls 3

_reopenMethod · 0.45
rename_nodeMethod · 0.45
get_nodeMethod · 0.45

Tested by

no test coverage detected