code: def test_typecheck() -> None:
      test_dir = Path(__file__).parent
  
      with tempfile.TemporaryDirectory() as tmpdir:
          shutil.copytree(
              test_dir,
              tmpdir + "/typing_tests",
              ignore=shutil.ignore_patterns(
                  "*.py", "_numpy.pyi", ".gitignore"
              ),
          )
  
          generate_test_code(Path(tmpdir))
          tests = list(Path(tmpdir).glob("**/*.pyi"))
          xpass = collect_xfails(tests)
          mypy_fails = run_mypy(tests)
  
      fails: dict[Pos, MypyError] = {}
      invalid: dict[Pos, MypyError] = {}
  
      # Check result
      for pos, err in mypy_fails.items():
          if pos in xpass:
              xfail = xpass.pop(pos)
              if pos.filename.endswith("_numpy.pyi"):
                  continue  # Skips checks of compatibility of error messages
              if xfail.mes not in err.mes or xfail.typ != err.typ:
                  invalid[pos] = err
          else:
              fails[pos] = err
  
      if invalid or fails or xpass:
          # Show error messages
          message = "\n\n"
          if invalid:
              message += "Invalid error message:\n"
              for (name, lineno), err in invalid.items():
                  message += f"{name}:{lineno}: {err.mes} [{err.typ}]\n"
          if fails:
              message += "FAILS:\n"
              for (name, lineno), err in fails.items():
                  message += f"{name}:{lineno}: {err.mes} [{err.typ}]\n"
          if xpass:
              message += "XPASS:\n"
              for (name, lineno), err in xpass.items():
                  message += f"{name}:{lineno}: {err.mes} [{err.typ}]\n"
          pytest.fail(message)
  
file_path: cupy/tests/typing_tests/test_typing.py
imports: import dataclasses
  from pathlib import Path
  import shutil
  import tempfile
  import typing
  import re
  import pytest
label_desc: Use image node_id 4 for calling a global function with example usage: test_typecheck() without return types