1+ """Test module for sklearn API integration."""
2+
13import numpy as np
24import pytest
35from sklearn import datasets , svm
3032
3133
3234def test_fit ():
35+ """Test fitting the HyperactiveSearchCV estimator."""
3336 search = HyperactiveSearchCV (svc , svc_params , opt )
3437 search .fit (X , y )
3538
3639 check_is_fitted (search )
3740
3841
3942def test_not_fitted ():
43+ """Test behavior when estimator is not fitted."""
4044 search = HyperactiveSearchCV (svc , svc_params , opt )
4145 assert not search .fit_successful
4246
@@ -47,6 +51,7 @@ def test_not_fitted():
4751
4852
4953def test_false_params ():
54+ """Test error handling with invalid parameters."""
5055 search = HyperactiveSearchCV (svc , nb_params , opt )
5156 with pytest .raises (ValueError ):
5257 search .fit (X , y )
@@ -55,6 +60,7 @@ def test_false_params():
5560
5661
5762def test_score ():
63+ """Test scoring functionality of the fitted estimator."""
5864 search = HyperactiveSearchCV (svc , svc_params , opt )
5965 search .fit (X , y )
6066 score = search .score (X , y )
@@ -63,13 +69,15 @@ def test_score():
6369
6470
6571def test_classes_ ():
72+ """Test access to fitted classes."""
6673 search = HyperactiveSearchCV (svc , svc_params , opt )
6774 search .fit (X , y )
6875
6976 assert [0 , 1 , 2 ] == list (search .classes_ )
7077
7178
7279def test_score_samples ():
80+ """Test score_samples method raises AttributeError."""
7381 search = HyperactiveSearchCV (svc , svc_params , opt )
7482 search .fit (X , y )
7583
@@ -78,6 +86,7 @@ def test_score_samples():
7886
7987
8088def test_predict ():
89+ """Test prediction functionality."""
8190 search = HyperactiveSearchCV (svc , svc_params , opt )
8291 search .fit (X , y )
8392 result = search .predict (X )
@@ -86,6 +95,7 @@ def test_predict():
8695
8796
8897def test_predict_proba ():
98+ """Test predict_proba method behavior."""
8999 search = HyperactiveSearchCV (svc , svc_params , opt )
90100 search .fit (X , y )
91101
@@ -100,6 +110,7 @@ def test_predict_proba():
100110
101111
102112def test_predict_log_proba ():
113+ """Test predict_log_proba method behavior."""
103114 search = HyperactiveSearchCV (svc , svc_params , opt )
104115 search .fit (X , y )
105116
@@ -114,6 +125,7 @@ def test_predict_log_proba():
114125
115126
116127def test_decision_function ():
128+ """Test decision_function method."""
117129 search = HyperactiveSearchCV (svc , svc_params , opt )
118130 search .fit (X , y )
119131 result = search .decision_function (X )
@@ -122,6 +134,7 @@ def test_decision_function():
122134
123135
124136def test_transform ():
137+ """Test transform method behavior."""
125138 search = HyperactiveSearchCV (svc , svc_params , opt )
126139 search .fit (X , y )
127140
@@ -136,6 +149,7 @@ def test_transform():
136149
137150
138151def test_inverse_transform ():
152+ """Test inverse_transform method behavior."""
139153 search = HyperactiveSearchCV (svc , svc_params , opt )
140154 search .fit (X , y )
141155
@@ -150,6 +164,7 @@ def test_inverse_transform():
150164
151165
152166def test_best_params_and_score ():
167+ """Test access to best parameters and score."""
153168 search = HyperactiveSearchCV (svc , svc_params , opt )
154169 search .fit (X , y )
155170
@@ -161,6 +176,7 @@ def test_best_params_and_score():
161176
162177
163178def test_search_data ():
179+ """Test access to search data after optimization."""
164180 n_iter = 50
165181 search = HyperactiveSearchCV (svc , svc_params , opt , n_iter = n_iter )
166182 search .fit (X , y )
0 commit comments