code: def test_deprecation_text_specified(text: Optional[str]) -> None:
      def _func() -> int:
          return 10
  
      decorator_deprecation = _deprecated.deprecated_func(
          "1.1.0", "3.0.0", text=text
      )
      decorated_func = decorator_deprecation(_func)
      expected_func_doc = _deprecated._DEPRECATION_NOTE_TEMPLATE.format(
          d_ver="1.1.0", r_ver="3.0.0"
      )
      if text is None:
          pass
      elif len(text) > 0:
          expected_func_doc += "\n\n    " + text + "\n"
      else:
          expected_func_doc += "\n\n\n"
      assert decorated_func.__name__ == _func.__name__
      assert decorated_func.__doc__ == expected_func_doc
  
      with pytest.warns(FutureWarning) as record:
          decorated_func()
      assert isinstance(record.list[0].message, Warning)
      expected_warning_message = (
          _deprecated._DEPRECATION_WARNING_TEMPLATE.format(
              name="_func", d_ver="1.1.0", r_ver="3.0.0"
          )
      )
      if text is not None:
          expected_warning_message += " " + text
      assert record.list[0].message.args[0] == expected_warning_message
  
file_path: optuna/tests/test_deprecated.py
imports: from typing import Any
  from typing import Optional
  import pytest
  from optuna import _deprecated
label_desc: Use image node_id 7 for calling a global function with example usage: test_deprecation_text_specified(text) and returns: int