Checking get_where_list & itersequence (float flavor)
(self)
| 1194 | self.assertEqual(results1, results2) |
| 1195 | |
| 1196 | def test08a(self): |
| 1197 | """Checking get_where_list & itersequence (float flavor)""" |
| 1198 | |
| 1199 | if common.verbose: |
| 1200 | print("\n", "-=" * 30) |
| 1201 | print("Running %s.test08a..." % self.__class__.__name__) |
| 1202 | |
| 1203 | table1 = self.h5file.root.table1 |
| 1204 | table2 = self.h5file.root.table2 |
| 1205 | |
| 1206 | # Convert the limits to the appropriate type |
| 1207 | il = float(self.il) |
| 1208 | sl = float(self.sl) |
| 1209 | |
| 1210 | # Do some selections and check the results |
| 1211 | t1col = table1.cols.var4 |
| 1212 | # First selection |
| 1213 | condition = "(il<=t1col)&(t1col<=sl)" |
| 1214 | # results1 = [p["var4"] for p in table1.where(condition)] |
| 1215 | self.assertTrue( |
| 1216 | table1.will_query_use_indexing(condition) |
| 1217 | == fzset([t1col.pathname]) |
| 1218 | ) |
| 1219 | table1.flavor = "python" |
| 1220 | rowList1 = table1.get_where_list(condition) |
| 1221 | results1 = [p["var4"] for p in table1.itersequence(rowList1)] |
| 1222 | results2 = [p["var4"] for p in table2 if il <= p["var4"] <= sl] |
| 1223 | # sort lists (indexing does not guarantee that rows are returned in |
| 1224 | # order) |
| 1225 | results1.sort() |
| 1226 | results2.sort() |
| 1227 | if common.verbose: |
| 1228 | print("Length results:", len(results1)) |
| 1229 | print("Should be:", len(results2)) |
| 1230 | self.assertEqual(len(results1), len(results2)) |
| 1231 | self.assertEqual(results1.sort(), results2.sort()) |
| 1232 | |
| 1233 | # Second selection |
| 1234 | condition = "(il<=t1col)&(t1col<sl)" |
| 1235 | self.assertTrue( |
| 1236 | table1.will_query_use_indexing(condition) |
| 1237 | == fzset([t1col.pathname]) |
| 1238 | ) |
| 1239 | table1.flavor = "python" |
| 1240 | rowList1 = table1.get_where_list(condition) |
| 1241 | results1 = [p["var4"] for p in table1.itersequence(rowList1)] |
| 1242 | results2 = [p["var4"] for p in table2 if il <= p["var4"] < sl] |
| 1243 | # sort lists (indexing does not guarantee that rows are returned in |
| 1244 | # order) |
| 1245 | results1.sort() |
| 1246 | results2.sort() |
| 1247 | if common.verbose: |
| 1248 | print("Length results:", len(results1)) |
| 1249 | print("Should be:", len(results2)) |
| 1250 | self.assertEqual(len(results1), len(results2)) |
| 1251 | self.assertEqual(results1, results2) |
| 1252 | |
| 1253 | # Third selection |
nothing calls this directly
no test coverage detected