@@ -596,3 +596,45 @@ def test_integration_constrained(target_func_x_and_y, pbounds, constraint, tmp_p
596596 new_optimizer .load_state (state_path )
597597
598598 verify_optimizers_match (optimizer , new_optimizer )
599+
600+
601+ def test_custom_acquisition_without_get_params ():
602+ """Test that a custom acquisition function without get_acquisition_params raises NotImplementedError."""
603+
604+ class CustomAcqWithoutGetParams (acquisition .AcquisitionFunction ):
605+ def __init__ (self , random_state = None ):
606+ super ().__init__ (random_state = random_state )
607+
608+ def base_acq (self , mean , std ):
609+ return mean + std
610+
611+ def set_acquisition_params (self , params ):
612+ pass
613+
614+ acq = CustomAcqWithoutGetParams ()
615+ with pytest .raises (
616+ NotImplementedError ,
617+ match = "Custom AcquisitionFunction subclasses must implement their own get_acquisition_params method" ,
618+ ):
619+ acq .get_acquisition_params ()
620+
621+
622+ def test_custom_acquisition_without_set_params ():
623+ """Test that a custom acquisition function without set_acquisition_params raises NotImplementedError."""
624+
625+ class CustomAcqWithoutSetParams (acquisition .AcquisitionFunction ):
626+ def __init__ (self , random_state = None ):
627+ super ().__init__ (random_state = random_state )
628+
629+ def base_acq (self , mean , std ):
630+ return mean + std
631+
632+ def get_acquisition_params (self ):
633+ return {}
634+
635+ acq = CustomAcqWithoutSetParams ()
636+ with pytest .raises (
637+ NotImplementedError ,
638+ match = "Custom AcquisitionFunction subclasses must implement their own set_acquisition_params method" ,
639+ ):
640+ acq .set_acquisition_params (params = {})
0 commit comments