Checking get_where_list & itersequence (int flavor)
(self)
| 997 | self.assertEqual(results1, results2) |
| 998 | |
| 999 | def test07a(self): |
| 1000 | """Checking get_where_list & itersequence (int flavor)""" |
| 1001 | |
| 1002 | if common.verbose: |
| 1003 | print("\n", "-=" * 30) |
| 1004 | print("Running %s.test07a..." % self.__class__.__name__) |
| 1005 | |
| 1006 | table1 = self.h5file.root.table1 |
| 1007 | table2 = self.h5file.root.table2 |
| 1008 | |
| 1009 | # Convert the limits to the appropriate type |
| 1010 | il = int(self.il) |
| 1011 | sl = int(self.sl) |
| 1012 | |
| 1013 | # Do some selections and check the results |
| 1014 | t1col = table1.cols.var3 |
| 1015 | # First selection |
| 1016 | condition = "(il<=t1col)&(t1col<=sl)" |
| 1017 | self.assertTrue( |
| 1018 | table1.will_query_use_indexing(condition) |
| 1019 | == fzset([t1col.pathname]) |
| 1020 | ) |
| 1021 | table1.flavor = "python" |
| 1022 | rowList1 = table1.get_where_list(condition) |
| 1023 | results1 = [p["var3"] for p in table1.itersequence(rowList1)] |
| 1024 | results2 = [p["var3"] for p in table2 if il <= p["var3"] <= sl] |
| 1025 | # sort lists (indexing does not guarantee that rows are returned in |
| 1026 | # order) |
| 1027 | results1.sort() |
| 1028 | results2.sort() |
| 1029 | if common.verbose: |
| 1030 | print("Length results:", len(results1)) |
| 1031 | print("Should be:", len(results2)) |
| 1032 | self.assertEqual(len(results1), len(results2)) |
| 1033 | self.assertEqual(results1.sort(), results2.sort()) |
| 1034 | |
| 1035 | # Second selection |
| 1036 | condition = "(il<=t1col)&(t1col<sl)" |
| 1037 | self.assertTrue( |
| 1038 | table1.will_query_use_indexing(condition) |
| 1039 | == fzset([t1col.pathname]) |
| 1040 | ) |
| 1041 | table1.flavor = "python" |
| 1042 | rowList1 = table1.get_where_list(condition) |
| 1043 | results1 = [p["var3"] for p in table1.itersequence(rowList1)] |
| 1044 | results2 = [p["var3"] for p in table2 if il <= p["var3"] < sl] |
| 1045 | # sort lists (indexing does not guarantee that rows are returned in |
| 1046 | # order) |
| 1047 | results1.sort() |
| 1048 | results2.sort() |
| 1049 | if common.verbose: |
| 1050 | print("Length results:", len(results1)) |
| 1051 | print("Should be:", len(results2)) |
| 1052 | self.assertEqual(len(results1), len(results2)) |
| 1053 | self.assertEqual(results1, results2) |
| 1054 | |
| 1055 | # Third selection |
| 1056 | condition = "(il<t1col)&(t1col<=sl)" |
nothing calls this directly
no test coverage detected