@@ -54,19 +54,30 @@ def sea_response_with_tables(self):
5454 "data_array" : [
5555 ["schema1" , "table1" , False , None , "catalog1" , "TABLE" , None ],
5656 ["schema1" , "table2" , False , None , "catalog1" , "VIEW" , None ],
57- ["schema1" , "table3" , False , None , "catalog1" , "SYSTEM TABLE" , None ],
57+ [
58+ "schema1" ,
59+ "table3" ,
60+ False ,
61+ None ,
62+ "catalog1" ,
63+ "SYSTEM TABLE" ,
64+ None ,
65+ ],
5866 ["schema1" , "table4" , False , None , "catalog1" , "EXTERNAL" , None ],
5967 ]
6068 },
6169 }
6270
6371 @pytest .fixture
64- def sea_result_set_with_tables (self , mock_connection , mock_sea_client , sea_response_with_tables ):
72+ def sea_result_set_with_tables (
73+ self , mock_connection , mock_sea_client , sea_response_with_tables
74+ ):
6575 """Create a SeaResultSet with table data."""
6676 # Create a deep copy of the response to avoid test interference
6777 import copy
78+
6879 sea_response_copy = copy .deepcopy (sea_response_with_tables )
69-
80+
7081 return SeaResultSet (
7182 connection = mock_connection ,
7283 sea_client = mock_sea_client ,
@@ -78,11 +89,15 @@ def sea_result_set_with_tables(self, mock_connection, mock_sea_client, sea_respo
7889 def test_filter_tables_by_type_default (self , sea_result_set_with_tables ):
7990 """Test filtering tables by type with default types."""
8091 # Default types are TABLE, VIEW, SYSTEM TABLE
81- filtered_result = ResultSetFilter .filter_tables_by_type (sea_result_set_with_tables )
92+ filtered_result = ResultSetFilter .filter_tables_by_type (
93+ sea_result_set_with_tables
94+ )
8295
8396 # Verify that only the default types are included
8497 assert len (filtered_result ._response ["result" ]["data_array" ]) == 3
85- table_types = [row [5 ] for row in filtered_result ._response ["result" ]["data_array" ]]
98+ table_types = [
99+ row [5 ] for row in filtered_result ._response ["result" ]["data_array" ]
100+ ]
86101 assert "TABLE" in table_types
87102 assert "VIEW" in table_types
88103 assert "SYSTEM TABLE" in table_types
@@ -97,7 +112,9 @@ def test_filter_tables_by_type_custom(self, sea_result_set_with_tables):
97112
98113 # Verify that only the specified types are included
99114 assert len (filtered_result ._response ["result" ]["data_array" ]) == 2
100- table_types = [row [5 ] for row in filtered_result ._response ["result" ]["data_array" ]]
115+ table_types = [
116+ row [5 ] for row in filtered_result ._response ["result" ]["data_array" ]
117+ ]
101118 assert "TABLE" in table_types
102119 assert "EXTERNAL" in table_types
103120 assert "VIEW" not in table_types
@@ -112,7 +129,9 @@ def test_filter_tables_by_type_case_insensitive(self, sea_result_set_with_tables
112129
113130 # Verify that the matching types are included despite case differences
114131 assert len (filtered_result ._response ["result" ]["data_array" ]) == 2
115- table_types = [row [5 ] for row in filtered_result ._response ["result" ]["data_array" ]]
132+ table_types = [
133+ row [5 ] for row in filtered_result ._response ["result" ]["data_array" ]
134+ ]
116135 assert "TABLE" in table_types
117136 assert "VIEW" in table_types
118137 assert "SYSTEM TABLE" not in table_types
@@ -126,7 +145,9 @@ def test_filter_tables_by_type_empty_list(self, sea_result_set_with_tables):
126145
127146 # Verify that default types are used
128147 assert len (filtered_result ._response ["result" ]["data_array" ]) == 3
129- table_types = [row [5 ] for row in filtered_result ._response ["result" ]["data_array" ]]
148+ table_types = [
149+ row [5 ] for row in filtered_result ._response ["result" ]["data_array" ]
150+ ]
130151 assert "TABLE" in table_types
131152 assert "VIEW" in table_types
132153 assert "SYSTEM TABLE" in table_types
@@ -144,21 +165,27 @@ def test_filter_by_column_values(self, sea_result_set_with_tables):
144165
145166 # Filter by table name in column index 1
146167 filtered_result = ResultSetFilter .filter_by_column_values (
147- sea_result_set_with_tables , column_index = 1 , allowed_values = ["table1" , "table3" ]
168+ sea_result_set_with_tables ,
169+ column_index = 1 ,
170+ allowed_values = ["table1" , "table3" ],
148171 )
149172
150173 # Only rows with table1 or table3 should be included
151174 assert len (filtered_result ._response ["result" ]["data_array" ]) == 2
152- table_names = [row [1 ] for row in filtered_result ._response ["result" ]["data_array" ]]
175+ table_names = [
176+ row [1 ] for row in filtered_result ._response ["result" ]["data_array" ]
177+ ]
153178 assert "table1" in table_names
154179 assert "table3" in table_names
155180 assert "table2" not in table_names
156181 assert "table4" not in table_names
157182
158- def test_filter_by_column_values_case_sensitive (self , mock_connection , mock_sea_client , sea_response_with_tables ):
183+ def test_filter_by_column_values_case_sensitive (
184+ self , mock_connection , mock_sea_client , sea_response_with_tables
185+ ):
159186 """Test case-sensitive filtering by column values."""
160187 import copy
161-
188+
162189 # Create a fresh result set for the first test
163190 sea_response_copy1 = copy .deepcopy (sea_response_with_tables )
164191 result_set1 = SeaResultSet (
@@ -168,18 +195,18 @@ def test_filter_by_column_values_case_sensitive(self, mock_connection, mock_sea_
168195 buffer_size_bytes = 1000 ,
169196 arraysize = 100 ,
170197 )
171-
198+
172199 # First test: Case-sensitive filtering with lowercase values (should find no matches)
173200 filtered_result = ResultSetFilter .filter_by_column_values (
174201 result_set1 ,
175202 column_index = 5 , # tableType column
176203 allowed_values = ["table" , "view" ], # lowercase
177204 case_sensitive = True ,
178205 )
179-
206+
180207 # Verify no matches with lowercase values
181208 assert len (filtered_result ._response ["result" ]["data_array" ]) == 0
182-
209+
183210 # Create a fresh result set for the second test
184211 sea_response_copy2 = copy .deepcopy (sea_response_with_tables )
185212 result_set2 = SeaResultSet (
@@ -189,20 +216,22 @@ def test_filter_by_column_values_case_sensitive(self, mock_connection, mock_sea_
189216 buffer_size_bytes = 1000 ,
190217 arraysize = 100 ,
191218 )
192-
219+
193220 # Second test: Case-sensitive filtering with correct case (should find matches)
194221 filtered_result = ResultSetFilter .filter_by_column_values (
195222 result_set2 ,
196223 column_index = 5 , # tableType column
197224 allowed_values = ["TABLE" , "VIEW" ], # correct case
198225 case_sensitive = True ,
199226 )
200-
227+
201228 # Verify matches with correct case
202229 assert len (filtered_result ._response ["result" ]["data_array" ]) == 2
203-
230+
204231 # Extract the table types from the filtered results
205- table_types = [row [5 ] for row in filtered_result ._response ["result" ]["data_array" ]]
232+ table_types = [
233+ row [5 ] for row in filtered_result ._response ["result" ]["data_array" ]
234+ ]
206235 assert "TABLE" in table_types
207236 assert "VIEW" in table_types
208237
@@ -214,4 +243,4 @@ def test_filter_by_column_values_out_of_bounds(self, sea_result_set_with_tables)
214243 )
215244
216245 # No rows should match
217- assert len (filtered_result ._response ["result" ]["data_array" ]) == 0
246+ assert len (filtered_result ._response ["result" ]["data_array" ]) == 0
0 commit comments