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

Method test11_moveGroup

tables/tests/test_basics.py:745–774  ·  view source on GitHub ↗

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

(self)

Source from the content-addressed store, hash-verified

743 self.assertIs(srcNode, dstNode)
744
745 def test11_moveGroup(self):
746 """Checking moving a Group and access it after a close/open."""
747
748 self._reopen(mode="r+", node_cache_slots=self.node_cache_slots)
749 newgroup = self.h5file.create_group(self.h5file.root, "newgroup")
750 self.h5file.move_node(self.h5file.root.agroup, newgroup, "agroup3")
751
752 # Open this file in read-only mode
753 self._reopen(node_cache_slots=self.node_cache_slots)
754
755 # Ensure that the new name exists
756 group = self.h5file.root.newgroup.agroup3
757 self.assertEqual(group._v_name, "agroup3")
758 self.assertEqual(group._v_pathname, "/newgroup/agroup3")
759 self.assertEqual(group._v_depth, 2)
760
761 # The children of this group must also be accessible through the
762 # new name path
763 group2 = self.h5file.get_node("/newgroup/agroup3/agroup3")
764 self.assertEqual(group2._v_name, "agroup3")
765 self.assertEqual(group2._v_pathname, "/newgroup/agroup3/agroup3")
766 self.assertEqual(group2._v_depth, 3)
767
768 # Try to get the previous object with the old name
769 with self.assertRaises(LookupError):
770 self.h5file.root.agroup
771
772 # Try to get a child with the old pathname
773 with self.assertRaises(LookupError):
774 self.h5file.get_node("/agroup/agroup3")
775
776 def test11b_moveGroup(self):
777 """Checking moving a Group and access it immediately."""

Callers

nothing calls this directly

Calls 4

create_groupMethod · 0.80
move_nodeMethod · 0.80
_reopenMethod · 0.45
get_nodeMethod · 0.45

Tested by

no test coverage detected