Checking get_where_list & itersequence (numpy string lims & python flavor)
(self)
| 841 | self.assertEqual(results1, results2) |
| 842 | |
| 843 | def test05b(self): |
| 844 | """Checking get_where_list & itersequence (numpy string lims & python |
| 845 | flavor)""" |
| 846 | |
| 847 | if common.verbose: |
| 848 | print("\n", "-=" * 30) |
| 849 | print("Running %s.test05b..." % self.__class__.__name__) |
| 850 | |
| 851 | table1 = self.h5file.root.table1 |
| 852 | table2 = self.h5file.root.table2 |
| 853 | |
| 854 | # Convert the limits to the appropriate type |
| 855 | # il = np.bytes_(self.il) |
| 856 | sl = np.bytes_(self.sl) |
| 857 | |
| 858 | # Do some selections and check the results |
| 859 | t1col = table1.cols.var1 |
| 860 | |
| 861 | # First selection |
| 862 | condition = "t1col<sl" |
| 863 | self.assertTrue( |
| 864 | table1.will_query_use_indexing(condition) |
| 865 | == fzset([t1col.pathname]) |
| 866 | ) |
| 867 | table1.flavor = "python" |
| 868 | rowList1 = table1.get_where_list(condition) |
| 869 | results1 = [p["var1"] for p in table1.itersequence(rowList1)] |
| 870 | results2 = [p["var1"] for p in table2 if p["var1"] < sl] |
| 871 | # sort lists (indexing does not guarantee that rows are returned in |
| 872 | # order) |
| 873 | results1.sort() |
| 874 | results2.sort() |
| 875 | if common.verbose: |
| 876 | print("Limit:", sl) |
| 877 | print("Length results:", len(results1)) |
| 878 | print("Should be:", len(results2)) |
| 879 | self.assertEqual(len(results1), len(results2)) |
| 880 | self.assertEqual(results1, results2) |
| 881 | |
| 882 | # Second selection |
| 883 | condition = "t1col<=sl" |
| 884 | self.assertTrue( |
| 885 | table1.will_query_use_indexing(condition) |
| 886 | == fzset([t1col.pathname]) |
| 887 | ) |
| 888 | rowList1 = table1.get_where_list(condition) |
| 889 | results1 = [p["var1"] for p in table1.itersequence(rowList1)] |
| 890 | results2 = [p["var1"] for p in table2 if p["var1"] <= sl] |
| 891 | # sort lists (indexing does not guarantee that rows are returned in |
| 892 | # order) |
| 893 | results1.sort() |
| 894 | results2.sort() |
| 895 | if common.verbose: |
| 896 | print("Limit:", sl) |
| 897 | print("Length results:", len(results1)) |
| 898 | print("Should be:", len(results2)) |
| 899 | self.assertEqual(len(results1), len(results2)) |
| 900 | self.assertEqual(results1, results2) |
nothing calls this directly
no test coverage detected