Checking non-indexed where() (float flavor)
(self)
| 1503 | table1._enable_indexing_in_queries() |
| 1504 | |
| 1505 | def test09b(self): |
| 1506 | """Checking non-indexed where() (float flavor)""" |
| 1507 | |
| 1508 | if common.verbose: |
| 1509 | print("\n", "-=" * 30) |
| 1510 | print("Running %s.test09b..." % self.__class__.__name__) |
| 1511 | |
| 1512 | table1 = self.h5file.root.table1 |
| 1513 | table2 = self.h5file.root.table2 |
| 1514 | |
| 1515 | table1._disable_indexing_in_queries() |
| 1516 | |
| 1517 | # Convert the limits to the appropriate type |
| 1518 | il = float(self.il) |
| 1519 | sl = float(self.sl) |
| 1520 | |
| 1521 | # Do some selections and check the results |
| 1522 | t1col = table1.cols.var4 |
| 1523 | self.assertIsNotNone(t1col) |
| 1524 | |
| 1525 | # First selection |
| 1526 | condition = "t1col<sl" |
| 1527 | self.assertTrue(not table1.will_query_use_indexing(condition)) |
| 1528 | results1 = [ |
| 1529 | p["var4"] for p in table1.where(condition, start=2, stop=5) |
| 1530 | ] |
| 1531 | results2 = [p["var4"] for p in table2.iterrows(2, 5) if p["var4"] < sl] |
| 1532 | if common.verbose: |
| 1533 | print("Limit:", sl) |
| 1534 | print("Length results:", len(results1)) |
| 1535 | print("Should be:", len(results2)) |
| 1536 | self.assertEqual(len(results1), len(results2)) |
| 1537 | self.assertEqual(results1, results2) |
| 1538 | |
| 1539 | # Second selection |
| 1540 | condition = "(il<t1col)&(t1col<=sl)" |
| 1541 | self.assertTrue(not table1.will_query_use_indexing(condition)) |
| 1542 | results1 = [ |
| 1543 | p["var4"] |
| 1544 | for p in table1.where(condition, start=2, stop=-1, step=2) |
| 1545 | ] |
| 1546 | results2 = [ |
| 1547 | p["var4"] |
| 1548 | for p in table2.iterrows(2, -1, 2) |
| 1549 | if il < p["var4"] <= sl |
| 1550 | ] |
| 1551 | if common.verbose: |
| 1552 | print("Limit:", sl) |
| 1553 | print("Length results:", len(results1)) |
| 1554 | print("Should be:", len(results2)) |
| 1555 | self.assertEqual(len(results1), len(results2)) |
| 1556 | self.assertEqual(results1, results2) |
| 1557 | |
| 1558 | # Third selection |
| 1559 | condition = "(il<=t1col)&(t1col<=sl)" |
| 1560 | self.assertTrue(not table1.will_query_use_indexing(condition)) |
| 1561 | results1 = [ |
| 1562 | p["var4"] for p in table1.where(condition, start=2, stop=-5) |
nothing calls this directly
no test coverage detected