Checking get_where_list & itersequence (numpy int limits & flavor)
(self)
| 1095 | self.assertEqual(results1, results2) |
| 1096 | |
| 1097 | def test07b(self): |
| 1098 | """Checking get_where_list & itersequence (numpy int limits & |
| 1099 | flavor)""" |
| 1100 | |
| 1101 | if common.verbose: |
| 1102 | print("\n", "-=" * 30) |
| 1103 | print("Running %s.test07b..." % self.__class__.__name__) |
| 1104 | |
| 1105 | table1 = self.h5file.root.table1 |
| 1106 | table2 = self.h5file.root.table2 |
| 1107 | |
| 1108 | # Convert the limits to the appropriate type |
| 1109 | # il = np.int32(self.il) |
| 1110 | sl = np.uint16(self.sl) |
| 1111 | |
| 1112 | # Do some selections and check the results |
| 1113 | t1col = table1.cols.var3 |
| 1114 | |
| 1115 | # First selection |
| 1116 | condition = "t1col<sl" |
| 1117 | self.assertTrue( |
| 1118 | table1.will_query_use_indexing(condition) |
| 1119 | == fzset([t1col.pathname]) |
| 1120 | ) |
| 1121 | table1.flavor = "python" |
| 1122 | rowList1 = table1.get_where_list(condition) |
| 1123 | results1 = [p["var3"] for p in table1.itersequence(rowList1)] |
| 1124 | results2 = [p["var3"] for p in table2 if p["var3"] < sl] |
| 1125 | # sort lists (indexing does not guarantee that rows are returned in |
| 1126 | # order) |
| 1127 | results1.sort() |
| 1128 | results2.sort() |
| 1129 | if common.verbose: |
| 1130 | print("Limit:", sl) |
| 1131 | print("Length results:", len(results1)) |
| 1132 | print("Should be:", len(results2)) |
| 1133 | self.assertEqual(len(results1), len(results2)) |
| 1134 | self.assertEqual(results1, results2) |
| 1135 | |
| 1136 | # Second selection |
| 1137 | condition = "t1col<=sl" |
| 1138 | self.assertTrue( |
| 1139 | table1.will_query_use_indexing(condition) |
| 1140 | == fzset([t1col.pathname]) |
| 1141 | ) |
| 1142 | rowList1 = table1.get_where_list(condition) |
| 1143 | results1 = [p["var3"] for p in table1.itersequence(rowList1)] |
| 1144 | results2 = [p["var3"] for p in table2 if p["var3"] <= sl] |
| 1145 | # sort lists (indexing does not guarantee that rows are returned in |
| 1146 | # order) |
| 1147 | results1.sort() |
| 1148 | results2.sort() |
| 1149 | if common.verbose: |
| 1150 | print("Limit:", sl) |
| 1151 | print("Length results:", len(results1)) |
| 1152 | print("Should be:", len(results2)) |
| 1153 | self.assertEqual(len(results1), len(results2)) |
| 1154 | self.assertEqual(results1, results2) |
nothing calls this directly
no test coverage detected