diff --git a/tests/test_observer.py b/tests/test_observer.py index 8c8d54eb2..c585757f3 100644 --- a/tests/test_observer.py +++ b/tests/test_observer.py @@ -2,6 +2,8 @@ import sys +import pytest + from bayes_opt.bayesian_optimization import Observable from bayes_opt.event import Events from bayes_opt.observer import _Tracker @@ -84,10 +86,8 @@ def max(self): assert tracker._previous_max_params is None test_instance = MockInstance() - tracker._update_tracker("other_event", test_instance) - assert tracker._iterations == 0 - assert tracker._previous_max is None - assert tracker._previous_max_params is None + with pytest.raises(ValueError, match="'other_event' is not a valid Events"): + tracker._update_tracker("other_event", test_instance) tracker._update_tracker(Events.OPTIMIZATION_STEP, test_instance) assert tracker._iterations == 1 @@ -121,6 +121,4 @@ def max(self): CommandLine: python tests/test_observer.py """ - import pytest - pytest.main([__file__])