88 pytest tests/modules/octo/test_column_ordering.py -v
99"""
1010
11- import warnings
12-
1311import numpy as np
1412import pandas as pd
13+ import pytest
1514
1615from octopus .models import Models
1716from octopus .models .hyperparameter import (
@@ -171,12 +170,12 @@ def _create_training(
171170 )
172171
173172
173+ @pytest .mark .filterwarnings ("ignore" )
174174class TestColumnOrdering :
175175 """Tests for ColumnTransformer column ordering with mixed types."""
176176
177177 def test_x_train_processed_columns_match_feature_cols (self ):
178178 """Verify x_train_processed has columns in feature_cols order after fit."""
179- warnings .filterwarnings ("ignore" )
180179 data , feature_cols , feature_groups = _create_mixed_type_data ()
181180 data_train , data_dev , data_test = _split_data (data )
182181
@@ -190,7 +189,6 @@ def test_x_train_processed_columns_match_feature_cols(self):
190189
191190 def test_x_dev_processed_columns_match_feature_cols (self ):
192191 """Verify x_dev_processed has columns in feature_cols order after fit."""
193- warnings .filterwarnings ("ignore" )
194192 data , feature_cols , feature_groups = _create_mixed_type_data ()
195193 data_train , data_dev , data_test = _split_data (data )
196194
@@ -201,7 +199,6 @@ def test_x_dev_processed_columns_match_feature_cols(self):
201199
202200 def test_x_test_processed_columns_match_feature_cols (self ):
203201 """Verify x_test_processed has columns in feature_cols order after fit."""
204- warnings .filterwarnings ("ignore" )
205202 data , feature_cols , feature_groups = _create_mixed_type_data ()
206203 data_train , data_dev , data_test = _split_data (data )
207204
@@ -212,7 +209,6 @@ def test_x_test_processed_columns_match_feature_cols(self):
212209
213210 def test_numerical_data_in_numerical_column (self ):
214211 """Verify that numerical columns in x_train_processed contain actual numerical data."""
215- warnings .filterwarnings ("ignore" )
216212 data , feature_cols , feature_groups = _create_mixed_type_data ()
217213 data_train , data_dev , data_test = _split_data (data )
218214
@@ -228,7 +224,6 @@ def test_numerical_data_in_numerical_column(self):
228224
229225 def test_categorical_data_in_categorical_column (self ):
230226 """Verify that categorical columns in x_train_processed contain actual categorical data."""
231- warnings .filterwarnings ("ignore" )
232227 data , feature_cols , feature_groups = _create_mixed_type_data ()
233228 data_train , data_dev , data_test = _split_data (data )
234229
@@ -247,7 +242,6 @@ def test_internal_fi_labels_correct_with_mixed_types(self):
247242
248243 Target is strongly correlated with num1, so num1 should have highest importance.
249244 """
250- warnings .filterwarnings ("ignore" )
251245 data , feature_cols , feature_groups = _create_mixed_type_data (n_samples = 500 )
252246 data_train , data_dev , data_test = _split_data (data )
253247
@@ -267,7 +261,6 @@ def test_internal_fi_labels_correct_with_mixed_types(self):
267261
268262 def test_permutation_fi_labels_correct_with_mixed_types (self ):
269263 """Verify permutation FI labels are correct when mixed column types exist."""
270- warnings .filterwarnings ("ignore" )
271264 data , feature_cols , feature_groups = _create_mixed_type_data (n_samples = 500 )
272265 data_train , data_dev , data_test = _split_data (data )
273266
@@ -287,7 +280,6 @@ def test_permutation_fi_labels_correct_with_mixed_types(self):
287280
288281 def test_all_numerical_columns_no_regression (self ):
289282 """Verify all-numerical columns still work correctly (regression test)."""
290- warnings .filterwarnings ("ignore" )
291283 data , feature_cols , feature_groups = _create_numerical_only_data ()
292284 data_train , data_dev , data_test = _split_data (data )
293285
@@ -304,7 +296,6 @@ def test_all_numerical_columns_no_regression(self):
304296
305297 def test_predict_works_with_mixed_types (self ):
306298 """Verify predict() works correctly with mixed column types."""
307- warnings .filterwarnings ("ignore" )
308299 data , feature_cols , feature_groups = _create_mixed_type_data ()
309300 data_train , data_dev , data_test = _split_data (data )
310301
@@ -317,7 +308,6 @@ def test_predict_works_with_mixed_types(self):
317308
318309 def test_predict_classification_with_mixed_types (self ):
319310 """Verify predict_proba() works correctly with mixed column types for classification."""
320- warnings .filterwarnings ("ignore" )
321311 data , feature_cols , feature_groups = _create_mixed_type_data ()
322312 data_train , data_dev , data_test = _split_data (data )
323313
@@ -341,7 +331,6 @@ def test_predict_classification_with_mixed_types(self):
341331
342332 def test_relabel_fallback_when_get_feature_names_out_fails (self ):
343333 """Verify fallback when get_feature_names_out() is not available."""
344- warnings .filterwarnings ("ignore" )
345334 data , feature_cols , feature_groups = _create_numerical_only_data ()
346335 data_train , data_dev , data_test = _split_data (data )
347336
0 commit comments