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

Method test09a_removeIndex

tables/tests/test_indexes.py:340–375  ·  view source on GitHub ↗

Checking removing an index.

(self)

Source from the content-addressed store, hash-verified

338 self.assertEqual(rowList1, rowList2)
339
340 def test09a_removeIndex(self):
341 """Checking removing an index."""
342
343 if common.verbose:
344 print("\n", "-=" * 30)
345 print(
346 "Running %s.test09a_removeIndex..." % self.__class__.__name__
347 )
348
349 # Open the HDF5 file in read-write mode
350 self.h5file = tb.open_file(self.h5fname, mode="a")
351 table = self.h5file.root.table
352 idxcol = table.cols.var1.index
353 if common.verbose:
354 print("Before deletion")
355 print("var1 column:", table.cols.var1)
356 self.assertEqual(table.colindexed["var1"], 1)
357 self.assertIsNotNone(idxcol)
358
359 # delete the index
360 table.cols.var1.remove_index()
361 if common.verbose:
362 print("After deletion")
363 print("var1 column:", table.cols.var1)
364 self.assertIsNone(table.cols.var1.index)
365 self.assertEqual(table.colindexed["var1"], 0)
366
367 # re-create the index again
368 indexrows = table.cols.var1.create_index(_blocksizes=small_blocksizes)
369 self.assertIsNotNone(indexrows)
370 idxcol = table.cols.var1.index
371 if common.verbose:
372 print("After re-creation")
373 print("var1 column:", table.cols.var1)
374 self.assertIsNotNone(idxcol)
375 self.assertEqual(table.colindexed["var1"], 1)
376
377 def test09b_removeIndex(self):
378 """Checking removing an index (persistent version)"""

Callers

nothing calls this directly

Calls 2

remove_indexMethod · 0.80
create_indexMethod · 0.80

Tested by

no test coverage detected