Checking get_where_list & itersequence (string, python flavor)
(self)
| 743 | self.assertEqual(results1, results2) |
| 744 | |
| 745 | def test05a(self): |
| 746 | """Checking get_where_list & itersequence (string, python flavor)""" |
| 747 | |
| 748 | if common.verbose: |
| 749 | print("\n", "-=" * 30) |
| 750 | print("Running %s.test05a..." % self.__class__.__name__) |
| 751 | |
| 752 | table1 = self.h5file.root.table1 |
| 753 | table2 = self.h5file.root.table2 |
| 754 | |
| 755 | # Convert the limits to the appropriate type |
| 756 | il = str(self.il).encode("ascii") |
| 757 | sl = str(self.sl).encode("ascii") |
| 758 | |
| 759 | # Do some selections and check the results |
| 760 | t1col = table1.cols.var1 |
| 761 | # First selection |
| 762 | condition = "(il<=t1col)&(t1col<=sl)" |
| 763 | self.assertTrue( |
| 764 | table1.will_query_use_indexing(condition) |
| 765 | == fzset([t1col.pathname]) |
| 766 | ) |
| 767 | table1.flavor = "python" |
| 768 | rowList1 = table1.get_where_list(condition) |
| 769 | results1 = [p["var1"] for p in table1.itersequence(rowList1)] |
| 770 | results2 = [p["var1"] for p in table2 if il <= p["var1"] <= sl] |
| 771 | # sort lists (indexing does not guarantee that rows are returned in |
| 772 | # order) |
| 773 | results1.sort() |
| 774 | results2.sort() |
| 775 | if common.verbose: |
| 776 | print("Length results:", len(results1)) |
| 777 | print("Should be:", len(results2)) |
| 778 | self.assertEqual(len(results1), len(results2)) |
| 779 | self.assertEqual(results1.sort(), results2.sort()) |
| 780 | |
| 781 | # Second selection |
| 782 | condition = "(il<=t1col)&(t1col<sl)" |
| 783 | self.assertTrue( |
| 784 | table1.will_query_use_indexing(condition) |
| 785 | == fzset([t1col.pathname]) |
| 786 | ) |
| 787 | table1.flavor = "python" |
| 788 | rowList1 = table1.get_where_list(condition) |
| 789 | results1 = [p["var1"] for p in table1.itersequence(rowList1)] |
| 790 | results2 = [p["var1"] for p in table2 if il <= p["var1"] < sl] |
| 791 | # sort lists (indexing does not guarantee that rows are returned in |
| 792 | # order) |
| 793 | results1.sort() |
| 794 | results2.sort() |
| 795 | if common.verbose: |
| 796 | print("Length results:", len(results1)) |
| 797 | print("Should be:", len(results2)) |
| 798 | self.assertEqual(len(results1), len(results2)) |
| 799 | self.assertEqual(results1, results2) |
| 800 | |
| 801 | # Third selection |
| 802 | condition = "(il<t1col)&(t1col<=sl)" |
nothing calls this directly
no test coverage detected