Checking moving a table with an index (no node cache).
(self)
| 536 | self.assertEqual(rowList1, rowList2) |
| 537 | |
| 538 | def test10d_moveIndex(self): |
| 539 | """Checking moving a table with an index (no node cache).""" |
| 540 | |
| 541 | if common.verbose: |
| 542 | print("\n", "-=" * 30) |
| 543 | print("Running %s.test10d_moveIndex..." % self.__class__.__name__) |
| 544 | |
| 545 | # Open the HDF5 file in read-write mode |
| 546 | self.h5file = tb.open_file(self.h5fname, mode="a", node_cache_slots=0) |
| 547 | table = self.h5file.root.table |
| 548 | idxcol = table.cols.var1.index |
| 549 | if common.verbose: |
| 550 | print("Before move") |
| 551 | print("var1 column:", idxcol) |
| 552 | self.assertEqual(table.colindexed["var1"], 1) |
| 553 | self.assertIsNotNone(idxcol) |
| 554 | |
| 555 | # Create a new group called "agroup" |
| 556 | agroup = self.h5file.create_group("/", "agroup") |
| 557 | |
| 558 | # move the table to "agroup" |
| 559 | table.move(agroup, "table2") |
| 560 | if common.verbose: |
| 561 | print("After move") |
| 562 | print("var1 column:", idxcol) |
| 563 | self.assertIsNotNone(table.cols.var1.index) |
| 564 | self.assertEqual(table.colindexed["var1"], 1) |
| 565 | |
| 566 | # Some sanity checks |
| 567 | table.flavor = "python" |
| 568 | rowList1 = table.get_where_list('var1 < b"10"') |
| 569 | rowList2 = [p.nrow for p in table if p["var1"] < b"10"] |
| 570 | if common.verbose: |
| 571 | print("Selected values:", rowList1) |
| 572 | print("Should look like:", rowList2) |
| 573 | self.assertEqual(len(rowList1), len(rowList2)) |
| 574 | self.assertEqual(rowList1, rowList2) |
| 575 | |
| 576 | def test11a_removeTableWithIndex(self): |
| 577 | """Checking removing a table with indexes.""" |
nothing calls this directly
no test coverage detected