code: def test_hookrelay_registration_by_specname_raises(
      pm: PluginManager,
  ) -> None:
      """Verify using specname still raises the types of errors during registration as it
      would have without using specname."""
  
      class Api:
          @hookspec
          def hello(self, arg: object) -> None:
              "api hook 1"
  
      pm.add_hookspecs(Api)
  
      # make sure a bad signature still raises an error when using specname
      class Plugin:
          @hookimpl(specname="hello")
          def foo(self, arg: int, too, many, args) -> int:
              return arg + 1
  
      with pytest.raises(PluginValidationError):
          pm.register(Plugin())
  
      # make sure check_pending still fails if specname doesn't have a
      # corresponding spec.  EVEN if the function name matches one.
      class Plugin2:
          @hookimpl(specname="bar")
          def hello(self, arg: int) -> int:
              return arg + 1
  
      pm.register(Plugin2())
      with pytest.raises(PluginValidationError):
          pm.check_pending()
  
imports: from typing import Callable
  from typing import List
  from typing import Sequence
  from typing import TypeVar
  import pytest
  from pluggy import HookimplMarker
  from pluggy import HookspecMarker
  from pluggy import PluginManager
  from pluggy import PluginValidationError
  from pluggy._hooks import _HookCaller
  from pluggy._hooks import HookImpl
label_desc: Use image node_id 16 for calling a global function with example usage: test_hookrelay_registration_by_specname_raises(pm) and returns: unknown, unknown