code: def test_create_beartype_decorator_warning_calls_function_once(self):
      call_count = 0
  
      def func_with_incorrect_type_hint_and_side_effect(x: int) -> str:
          nonlocal call_count
          call_count += 1
          return x  # type: ignore[return-value]
  
      decorator = _beartype._create_beartype_decorator(
          _beartype.RuntimeTypeCheckState.WARNINGS,
      )
      decorated = decorator(
          func_with_incorrect_type_hint_and_side_effect
      )
      decorated("string_input")  # type: ignore[arg-type]
      self.assertEqual(call_count, 1)
      decorated(1)
      # The return value violates the type hint, but the function is called
      # only once.
      self.assertEqual(call_count, 2)
  
file_path: pytorch/test/onnx/internal/test_beartype.py
imports: import unittest
  from torch.onnx._internal import _beartype
  from torch.testing._internal import common_utils
label_desc: Use image node_id 4 for calling the TestBeartype obj's underlying member method code with example usage: obj.test_create_beartype_decorator_warning_calls_function_once() and returns: x