Checking removing an index (persistent version)
(self)
| 375 | self.assertEqual(table.colindexed["var1"], 1) |
| 376 | |
| 377 | def test09b_removeIndex(self): |
| 378 | """Checking removing an index (persistent version)""" |
| 379 | |
| 380 | if common.verbose: |
| 381 | print("\n", "-=" * 30) |
| 382 | print( |
| 383 | "Running %s.test09b_removeIndex..." % self.__class__.__name__ |
| 384 | ) |
| 385 | |
| 386 | # Open the HDF5 file in read-write mode |
| 387 | self.h5file = tb.open_file(self.h5fname, mode="a") |
| 388 | table = self.h5file.root.table |
| 389 | idxcol = table.cols.var1.index |
| 390 | if common.verbose: |
| 391 | print("Before deletion") |
| 392 | print("var1 index column:", table.cols.var1) |
| 393 | self.assertIsNotNone(idxcol) |
| 394 | self.assertEqual(table.colindexed["var1"], 1) |
| 395 | # delete the index |
| 396 | table.cols.var1.remove_index() |
| 397 | |
| 398 | # close and reopen the file |
| 399 | self._reopen(mode="a") |
| 400 | table = self.h5file.root.table |
| 401 | idxcol = table.cols.var1.index |
| 402 | |
| 403 | if common.verbose: |
| 404 | print("After deletion") |
| 405 | print("var1 column:", table.cols.var1) |
| 406 | self.assertIsNone(table.cols.var1.index) |
| 407 | self.assertEqual(table.colindexed["var1"], 0) |
| 408 | |
| 409 | # re-create the index again |
| 410 | indexrows = table.cols.var1.create_index(_blocksizes=small_blocksizes) |
| 411 | self.assertIsNotNone(indexrows) |
| 412 | idxcol = table.cols.var1.index |
| 413 | if common.verbose: |
| 414 | print("After re-creation") |
| 415 | print("var1 column:", table.cols.var1) |
| 416 | self.assertIsNotNone(idxcol) |
| 417 | self.assertEqual(table.colindexed["var1"], 1) |
| 418 | |
| 419 | def test10a_moveIndex(self): |
| 420 | """Checking moving a table with an index.""" |
nothing calls this directly
no test coverage detected