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

Method test08_initialmark

tables/tests/test_do_undo.py:665–697  ·  view source on GitHub ↗

Checking initial mark.

(self)

Source from the content-addressed store, hash-verified

663 self.assertEqual(self.h5file.root.otherarray4.read(), [6, 7])
664
665 def test08_initialmark(self):
666 """Checking initial mark."""
667
668 if common.verbose:
669 print("\n", "-=" * 30)
670 print("Running %s.test08_initialmark..." % self.__class__.__name__)
671
672 # open the do/undo
673 self.h5file.enable_undo()
674 initmid = self.h5file.get_current_mark()
675
676 # Create a new array
677 self.h5file.create_array("/", "otherarray", [3, 4], "Another array")
678 self.h5file.mark()
679 self._do_reopen()
680 self.h5file.create_array("/", "otherarray2", [4, 5], "Another array 2")
681
682 # Now undo the past operations
683 self.h5file.undo(initmid)
684 self.assertNotIn("/otherarray", self.h5file)
685 self.assertNotIn("/otherarray2", self.h5file)
686
687 # Redo all the operations
688 self.h5file.redo(-1)
689 self._do_reopen()
690
691 # Check that objects has come back to life in a sane state
692 self.assertIn("/otherarray", self.h5file)
693 self.assertIn("/otherarray2", self.h5file)
694 self.assertEqual(self.h5file.root.otherarray.read(), [3, 4])
695 self.assertEqual(self.h5file.root.otherarray2.read(), [4, 5])
696 self.assertEqual(self.h5file.root.otherarray.title, "Another array")
697 self.assertEqual(self.h5file.root.otherarray2.title, "Another array 2")
698
699 def test09_marknames(self):
700 """Checking mark names (wrong direction)"""

Callers

nothing calls this directly

Calls 8

_do_reopenMethod · 0.95
enable_undoMethod · 0.80
get_current_markMethod · 0.80
markMethod · 0.80
undoMethod · 0.80
redoMethod · 0.80
create_arrayMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected