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

Method test10_2b_bis_moveTable

tables/tests/test_basics.py:682–706  ·  view source on GitHub ↗

Checking moving a table and use cached row without a close/open.

(self)

Source from the content-addressed store, hash-verified

680 self.h5file.root.atable
681
682 def test10_2b_bis_moveTable(self):
683 """Checking moving a table and use cached row without a close/open."""
684
685 self._reopen(mode="r+", node_cache_slots=self.node_cache_slots)
686 newgroup = self.h5file.create_group("/", "newgroup")
687
688 # Cache the Row attribute prior to the move
689 row = self.h5file.root.atable.row
690 self.h5file.move_node(self.h5file.root.atable, newgroup, "atable2")
691
692 # Ensure that the new name exists
693 table_ = self.h5file.root.newgroup.atable2
694 self.assertEqual(table_.name, "atable2")
695 self.assertEqual(table_._v_pathname, "/newgroup/atable2")
696 self.assertEqual(table_._v_depth, 2)
697
698 # Ensure that cache Row attribute has been updated
699 row = table_.row
700 self.assertEqual(table_._v_pathname, row.table._v_pathname)
701 nrows = table_.nrows
702
703 # Add a new row just to make sure that this works
704 row.append()
705 table_.flush()
706 self.assertEqual(table_.nrows, nrows + 1)
707
708 def test10_2c_moveTable(self):
709 """Checking moving tables and modify attributes after that."""

Callers

nothing calls this directly

Calls 5

create_groupMethod · 0.80
move_nodeMethod · 0.80
_reopenMethod · 0.45
appendMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected