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

Method test00

tables/tests/test_do_undo.py:1011–1036  ·  view source on GitHub ↗

Checking one action.

(self)

Source from the content-addressed store, hash-verified

1009 h5file.create_group(group, "agroup3", "Group title 3")
1010
1011 def test00(self):
1012 """Checking one action."""
1013
1014 if common.verbose:
1015 print("\n", "-=" * 30)
1016 print("Running %s.test00..." % self.__class__.__name__)
1017
1018 # open the do/undo
1019 self.h5file.enable_undo()
1020
1021 # Create a new array
1022 self.h5file.create_array("/", "otherarray1", [1, 2], "Another array 1")
1023
1024 # Now undo the past operation
1025 self.h5file.undo()
1026
1027 # Check that otherarray does not exist in the object tree
1028 self.assertNotIn("/otherarray1", self.h5file)
1029
1030 # Redo the operation
1031 self.h5file.redo()
1032
1033 # Check that otherarray has come back to life in a sane state
1034 self.assertIn("/otherarray1", self.h5file)
1035 self.assertEqual(self.h5file.root.otherarray1.title, "Another array 1")
1036 self.assertEqual(self.h5file.root.otherarray1.read(), [1, 2])
1037
1038 def test01(self):
1039 """Checking two actions."""

Callers

nothing calls this directly

Calls 5

enable_undoMethod · 0.80
undoMethod · 0.80
redoMethod · 0.80
create_arrayMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected