code: def test_deprecated_function():
      def foo(bar=1):
          return bar * bar
  
      @deprecated_fn()
      def fee(baz=3):
          return foo(baz + 2)
  
      @deprecated_fn(replaced_by=foo)
      def Foo():
          pass
  
      @deprecated_fn(replaced_by=foo, msg="custom FOO message")
      def FOO():
          pass
  
      @deprecated_fn(msg="deprecated, replaced by ``foo``")
      def foo_old_defaults(bar=2):
          return foo(bar=bar)
  
      with warnings.catch_warnings(record=True) as w:
          warnings.simplefilter("always")
          assert fee() == 25  # 1st warning
          assert Foo() == 1  # 2nd warning
          assert Foo(3) == 9  # 3rd warning
          assert FOO() == 1  # 4th warning
          assert FOO(9) == 81  # 5th warning
          assert foo_old_defaults() == 4  # 6th warning
          assert foo_old_defaults(3) == 9  # 7th warning
          assert len(w) == 7
          assert re.match(
              r"``[\w.<>]*fee`` is deprecated.", str(w[0].message)
          )
          assert re.match(
              r"``[\w.<>]*Foo`` is deprecated, please use ``[\w.<>]*foo`` instead.",
              str(w[1].message),
          )
          assert str(w[3].message) == "custom FOO message"
          assert str(w[5].message) == "deprecated, replaced by ``foo``"
  
file_path: h2o-3/h2o-py/tests/testdir_utils/pyunit_deprecations.py
imports: import os
  import re
  import sys
  import warnings
  from h2o.utils.metaclass import deprecated_params, deprecated_property, deprecated_fn, fullname
  from tests import pyunit_utils
label_desc: Use image node_id 6 for calling a global function with example usage: test_deprecated_function() and returns: unknown, foo, foo