code: def test_prime_subscriptions():
      optimizer = BayesianOptimization(
          target_func, PBOUNDS, random_state=1
      )
      optimizer._prime_subscriptions()
  
      # Test that the default observer is correctly subscribed
      for event in DEFAULT_EVENTS:
          assert all(
              [
                  isinstance(k, ScreenLogger)
                  for k in optimizer._events[event].keys()
              ]
          )
          assert all(
              [
                  hasattr(k, "update")
                  for k in optimizer._events[event].keys()
              ]
          )
  
      test_subscriber = "test_subscriber"
  
      def test_callback(event, instance):
          pass
  
      optimizer = BayesianOptimization(
          target_func, PBOUNDS, random_state=1
      )
      optimizer.subscribe(
          event=Events.OPTIMIZATION_START,
          subscriber=test_subscriber,
          callback=test_callback,
      )
      # Test that the desired observer is subscribed
      assert all(
          [
              k == test_subscriber
              for k in optimizer._events[
                  Events.OPTIMIZATION_START
              ].keys()
          ]
      )
      assert all(
          [
              v == test_callback
              for v in optimizer._events[
                  Events.OPTIMIZATION_START
              ].values()
          ]
      )
  
      # Check that prime subscriptions won't overwrite manual subscriptions
      optimizer._prime_subscriptions()
      assert all(
          [
              k == test_subscriber
              for k in optimizer._events[
                  Events.OPTIMIZATION_START
              ].keys()
          ]
      )
      assert all(
          [
              v == test_callback
              for v in optimizer._events[
                  Events.OPTIMIZATION_START
              ].values()
          ]
      )
  
      assert optimizer._events[Events.OPTIMIZATION_STEP] == {}
      assert optimizer._events[Events.OPTIMIZATION_END] == {}
  
      with pytest.raises(KeyError):
          optimizer._events["other"]
  
imports: import pytest
  import numpy
  from bayes_opt import UtilityFunction
  from bayes_opt import BayesianOptimization
  from bayes_opt.logger import ScreenLogger
  from bayes_opt.event import Events, DEFAULT_EVENTS
  from bayes_opt.util import NotUniqueError
  import pickle
  import os
label_desc: Use image node_id 11 for calling a global function with example usage: test_prime_subscriptions() without return types