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

Method test10_gotoint

tables/tests/test_do_undo.py:797–860  ·  view source on GitHub ↗

Checking mark sequential ids (goto)

(self)

Source from the content-addressed store, hash-verified

795 self.assertEqual(self.h5file.root.otherarray4.read(), [6, 7])
796
797 def test10_gotoint(self):
798 """Checking mark sequential ids (goto)"""
799
800 if common.verbose:
801 print("\n", "-=" * 30)
802 print("Running %s.test10_gotoint..." % self.__class__.__name__)
803
804 # open the do/undo
805 self.h5file.enable_undo()
806
807 # Create a new array
808 self.h5file.create_array("/", "otherarray1", [3, 4], "Another array 1")
809 self.h5file.mark("first")
810 self.h5file.create_array("/", "otherarray2", [4, 5], "Another array 2")
811 self.h5file.mark("second")
812 self._do_reopen()
813 self.h5file.create_array("/", "otherarray3", [5, 6], "Another array 3")
814 self.h5file.mark("third")
815 self.h5file.create_array("/", "otherarray4", [6, 7], "Another array 4")
816
817 # Now go to mark "first"
818 self.h5file.goto(1)
819 self._do_reopen()
820 self.assertIn("/otherarray1", self.h5file)
821 self.assertNotIn("/otherarray2", self.h5file)
822 self.assertNotIn("/otherarray3", self.h5file)
823 self.assertNotIn("/otherarray4", self.h5file)
824
825 # Go to beginning
826 self.h5file.goto(0)
827 self.assertNotIn("/otherarray1", self.h5file)
828 self.assertNotIn("/otherarray2", self.h5file)
829 self.assertNotIn("/otherarray3", self.h5file)
830 self.assertNotIn("/otherarray4", self.h5file)
831
832 # Go to mark "third"
833 self._do_reopen()
834 self.h5file.goto(3)
835 self.assertIn("/otherarray1", self.h5file)
836 self.assertIn("/otherarray2", self.h5file)
837 self.assertIn("/otherarray3", self.h5file)
838 self.assertNotIn("/otherarray4", self.h5file)
839
840 # Now go to mark "second"
841 self.h5file.goto(2)
842 self.assertIn("/otherarray1", self.h5file)
843 self.assertIn("/otherarray2", self.h5file)
844 self.assertNotIn("/otherarray3", self.h5file)
845 self.assertNotIn("/otherarray4", self.h5file)
846
847 # Go to the end
848 self._do_reopen()
849 self.h5file.goto(-1)
850 self.assertIn("/otherarray1", self.h5file)
851 self.assertIn("/otherarray2", self.h5file)
852 self.assertIn("/otherarray3", self.h5file)
853 self.assertIn("/otherarray4", self.h5file)
854

Callers

nothing calls this directly

Calls 6

_do_reopenMethod · 0.95
enable_undoMethod · 0.80
markMethod · 0.80
gotoMethod · 0.80
create_arrayMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected