Check non-indexed where() w/ ranges, changing step (string flavor)
(self)
| 1596 | table1._enable_indexing_in_queries() |
| 1597 | |
| 1598 | def test09c(self): |
| 1599 | """Check non-indexed where() w/ ranges, changing step |
| 1600 | (string flavor)""" |
| 1601 | |
| 1602 | if common.verbose: |
| 1603 | print("\n", "-=" * 30) |
| 1604 | print("Running %s.test09c..." % self.__class__.__name__) |
| 1605 | |
| 1606 | table1 = self.h5file.root.table1 |
| 1607 | table2 = self.h5file.root.table2 |
| 1608 | |
| 1609 | table1._disable_indexing_in_queries() |
| 1610 | |
| 1611 | # Convert the limits to the appropriate type |
| 1612 | il = str(self.il).encode("ascii") |
| 1613 | sl = str(self.sl).encode("ascii") |
| 1614 | |
| 1615 | # Do some selections and check the results |
| 1616 | t1col = table1.cols.var1 |
| 1617 | self.assertIsNotNone(t1col) |
| 1618 | |
| 1619 | # First selection |
| 1620 | condition = "t1col>=sl" |
| 1621 | self.assertTrue(not table1.will_query_use_indexing(condition)) |
| 1622 | results1 = [ |
| 1623 | p["var1"] |
| 1624 | for p in table1.where(condition, start=2, stop=-1, step=3) |
| 1625 | ] |
| 1626 | results2 = [ |
| 1627 | p["var1"] for p in table2.iterrows(2, -1, 3) if p["var1"] >= sl |
| 1628 | ] |
| 1629 | # sort lists (indexing does not guarantee that rows are returned in |
| 1630 | # order) |
| 1631 | results1.sort() |
| 1632 | results2.sort() |
| 1633 | if common.verbose: |
| 1634 | print("Limits:", il, sl) |
| 1635 | print("Length results:", len(results1)) |
| 1636 | print("Should be:", len(results2)) |
| 1637 | self.assertEqual(len(results1), len(results2)) |
| 1638 | self.assertEqual(results1, results2) |
| 1639 | |
| 1640 | # Second selection |
| 1641 | condition = "t1col>=sl" |
| 1642 | self.assertTrue(not table1.will_query_use_indexing(condition)) |
| 1643 | results1 = [ |
| 1644 | p["var1"] |
| 1645 | for p in table1.where(condition, start=5, stop=-1, step=10) |
| 1646 | ] |
| 1647 | results2 = [ |
| 1648 | p["var1"] for p in table2.iterrows(5, -1, 10) if p["var1"] >= sl |
| 1649 | ] |
| 1650 | # sort lists (indexing does not guarantee that rows are returned in |
| 1651 | # order) |
| 1652 | results1.sort() |
| 1653 | results2.sort() |
| 1654 | if common.verbose: |
| 1655 | print("Limits:", il, sl) |
nothing calls this directly
no test coverage detected