Checking get_where_list & itersequence (numpy float limits & flavor)
(self)
| 1293 | self.assertEqual(results1, results2) |
| 1294 | |
| 1295 | def test08b(self): |
| 1296 | """Checking get_where_list & itersequence (numpy float limits & |
| 1297 | flavor)""" |
| 1298 | |
| 1299 | if common.verbose: |
| 1300 | print("\n", "-=" * 30) |
| 1301 | print("Running %s.test08b..." % self.__class__.__name__) |
| 1302 | |
| 1303 | table1 = self.h5file.root.table1 |
| 1304 | table2 = self.h5file.root.table2 |
| 1305 | |
| 1306 | # Convert the limits to the appropriate type |
| 1307 | # il = np.float32(self.il) |
| 1308 | sl = np.float64(self.sl) |
| 1309 | |
| 1310 | # Do some selections and check the results |
| 1311 | t1col = table1.cols.var4 |
| 1312 | |
| 1313 | # First selection |
| 1314 | condition = "t1col<sl" |
| 1315 | self.assertTrue( |
| 1316 | table1.will_query_use_indexing(condition) |
| 1317 | == fzset([t1col.pathname]) |
| 1318 | ) |
| 1319 | rowList1 = table1.get_where_list(condition) |
| 1320 | results1 = [p["var4"] for p in table1.itersequence(rowList1)] |
| 1321 | results2 = [p["var4"] for p in table2 if p["var4"] < sl] |
| 1322 | # sort lists (indexing does not guarantee that rows are returned in |
| 1323 | # order) |
| 1324 | results1.sort() |
| 1325 | results2.sort() |
| 1326 | if common.verbose: |
| 1327 | print("Limit:", sl) |
| 1328 | print("Length results:", len(results1)) |
| 1329 | print("Should be:", len(results2)) |
| 1330 | self.assertEqual(len(results1), len(results2)) |
| 1331 | self.assertEqual(results1, results2) |
| 1332 | |
| 1333 | # Second selection |
| 1334 | condition = "t1col<=sl" |
| 1335 | self.assertTrue( |
| 1336 | table1.will_query_use_indexing(condition) |
| 1337 | == fzset([t1col.pathname]) |
| 1338 | ) |
| 1339 | rowList1 = table1.get_where_list(condition) |
| 1340 | results1 = [p["var4"] for p in table1.itersequence(rowList1)] |
| 1341 | results2 = [p["var4"] for p in table2 if p["var4"] <= sl] |
| 1342 | # sort lists (indexing does not guarantee that rows are returned in |
| 1343 | # order) |
| 1344 | results1.sort() |
| 1345 | results2.sort() |
| 1346 | if common.verbose: |
| 1347 | print("Limit:", sl) |
| 1348 | print("Length results:", len(results1)) |
| 1349 | print("Should be:", len(results2)) |
| 1350 | self.assertEqual(len(results1), len(results2)) |
| 1351 | self.assertEqual(results1, results2) |
| 1352 |
nothing calls this directly
no test coverage detected