@@ -183,71 +183,3 @@ def test_optuna_storage_uri_conversion() -> None:
183183 import ray .tune .search .optuna
184184
185185 assert isinstance (algorithm , ray .tune .search .optuna .OptunaSearch )
186-
187-
188- def test_optuna_storage_without_storage () -> None :
189- """Test that Optuna algorithm works without storage (default behavior)."""
190- # Create a tuner with minimal configuration
191- tuner = Tuner (
192- objective = ObjectiveSpec (
193- object_type = "component" , object_name = "test" , field_type = "field" , field_name = "value"
194- ),
195- parameters = [
196- FloatParameterSpec (
197- object_type = "component" ,
198- object_name = "test" ,
199- field_type = "arg" ,
200- field_name = "param" ,
201- lower = 0.0 ,
202- upper = 1.0 ,
203- )
204- ],
205- num_samples = 1 ,
206- mode = "max" ,
207- )
208-
209- # Test the _build_algorithm method without storage
210- optuna_spec = OptunaSpec (
211- type = "ray.tune.search.optuna.OptunaSearch" ,
212- study_name = "test-study" ,
213- # Note: no storage specified
214- )
215-
216- # This should work (existing behavior)
217- algorithm = tuner ._build_algorithm (optuna_spec )
218-
219- # Verify the algorithm was created successfully
220- import ray .tune .search .optuna
221-
222- assert isinstance (algorithm , ray .tune .search .optuna .OptunaSearch )
223-
224-
225- def test_optuna_invalid_storage_uri () -> None :
226- """Test that invalid storage URIs raise appropriate errors."""
227- # Create a tuner with minimal configuration
228- tuner = Tuner (
229- objective = ObjectiveSpec (
230- object_type = "component" , object_name = "test" , field_type = "field" , field_name = "value"
231- ),
232- parameters = [
233- FloatParameterSpec (
234- object_type = "component" ,
235- object_name = "test" ,
236- field_type = "arg" ,
237- field_name = "param" ,
238- lower = 0.0 ,
239- upper = 1.0 ,
240- )
241- ],
242- num_samples = 1 ,
243- mode = "max" ,
244- )
245-
246- # Test the _build_algorithm method with invalid storage URI
247- optuna_spec = OptunaSpec (
248- type = "ray.tune.search.optuna.OptunaSearch" , study_name = "test-study" , storage = "invalid://uri"
249- )
250-
251- # This should raise a ValueError with helpful message
252- with pytest .raises (ValueError , match = "Failed to create Optuna storage from URI" ):
253- tuner ._build_algorithm (optuna_spec )
0 commit comments