code: def test_verbosity(capsys: _pytest.capture.CaptureFixture) -> None:
      # We need to reconstruct our default handler to properly capture stderr.
      optuna.logging._reset_library_root_logger()
      library_root_logger = optuna.logging._get_library_root_logger()
      example_logger = optuna.logging.get_logger("optuna.hoge")
      optuna.logging.enable_default_handler()
  
      # level INFO
      optuna.logging.set_verbosity(optuna.logging.INFO)
      assert library_root_logger.getEffectiveLevel() == logging.INFO
      example_logger.warning("hello-warning")
      example_logger.info("hello-info")
      example_logger.debug("hello-debug")
      _, err = capsys.readouterr()
      assert "hello-warning" in err
      assert "hello-info" in err
      assert "hello-debug" not in err
  
      # level WARNING
      optuna.logging.set_verbosity(optuna.logging.WARNING)
      assert library_root_logger.getEffectiveLevel() == logging.WARNING
      example_logger.warning("bye-warning")
      example_logger.info("bye-info")
      example_logger.debug("bye-debug")
      _, err = capsys.readouterr()
      assert "bye-warning" in err
      assert "bye-info" not in err
      assert "bye-debug" 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 3 for calling a global function with example usage: test_verbosity(capsys) without return types