code: def test_default_handler(
      capsys: _pytest.capture.CaptureFixture,
  ) -> None:
      # We need to reconstruct our default handler to properly capture stderr.
      optuna.logging._reset_library_root_logger()
      optuna.logging.set_verbosity(optuna.logging.INFO)
  
      library_root_logger = optuna.logging._get_library_root_logger()
  
      example_logger = optuna.logging.get_logger("optuna.bar")
  
      # Default handler enabled
      optuna.logging.enable_default_handler()
      assert library_root_logger.handlers
      example_logger.info("hey")
      _, err = capsys.readouterr()
      assert "hey" in err
  
      # Default handler disabled
      optuna.logging.disable_default_handler()
      assert not library_root_logger.handlers
      example_logger.info("yoyo")
      _, err = capsys.readouterr()
      assert "yoyo" not in err
  
file_path: optuna/tests/test_logging.py
imports: import logging
  import _pytest.capture
  import _pytest.logging
  import optuna.logging
label_desc: Use image node_id 2 for calling a global function with example usage: test_default_handler(capsys) without return types