code: def test_api_name_set_for_all_events(connect):
      with gr.Blocks() as demo:
          i = Textbox()
          o = Textbox()
          btn = Button()
          btn1 = Button()
          btn2 = Button()
          btn3 = Button()
          btn4 = Button()
          btn5 = Button()
          btn6 = Button()
          btn7 = Button()
          btn8 = Button()
  
          def greet(i):
              return "Hello " + i
  
          def goodbye(i):
              return "Goodbye " + i
  
          def greet_me(i):
              return "Hello"
  
          def say_goodbye(i):
              return "Goodbye"
  
          say_goodbye.__name__ = "Say_$$_goodbye"
  
          # Otherwise changed by ruff
          foo = lambda s: s  # noqa
  
          def foo2(s):
              return s + " foo"
  
          foo2.__name__ = "foo-2"
  
          class Callable:
              def __call__(self, a) -> str:
                  return "From __call__"
  
          def from_partial(a, b):
              return b + a
  
          part = functools.partial(from_partial, b="From partial: ")
  
          btn.click(greet, i, o)
          btn1.click(goodbye, i, o)
          btn2.click(greet_me, i, o)
          btn3.click(say_goodbye, i, o)
          btn4.click(None, i, o)
          btn5.click(foo, i, o)
          btn6.click(foo2, i, o)
          btn7.click(Callable(), i, o)
          btn8.click(part, i, o)
  
      with closing(demo) as io:
          app, _, _ = io.launch(prevent_thread_lock=True)
          client = TestClient(app)
          assert client.post(
              "/api/greet",
              json={"data": ["freddy"], "session_hash": "foo"},
          ).json()["data"] == ["Hello freddy"]
          assert client.post(
              "/api/goodbye",
              json={"data": ["freddy"], "session_hash": "foo"},
          ).json()["data"] == ["Goodbye freddy"]
          assert client.post(
              "/api/greet_me",
              json={"data": ["freddy"], "session_hash": "foo"},
          ).json()["data"] == ["Hello"]
          assert client.post(
              "/api/Say__goodbye",
              json={"data": ["freddy"], "session_hash": "foo"},
          ).json()["data"] == ["Goodbye"]
          assert client.post(
              "/api/lambda",
              json={"data": ["freddy"], "session_hash": "foo"},
          ).json()["data"] == ["freddy"]
          assert client.post(
              "/api/foo-2",
              json={"data": ["freddy"], "session_hash": "foo"},
          ).json()["data"] == ["freddy foo"]
          assert client.post(
              "/api/Callable",
              json={"data": ["freddy"], "session_hash": "foo"},
          ).json()["data"] == ["From __call__"]
          assert client.post(
              "/api/partial",
              json={"data": ["freddy"], "session_hash": "foo"},
          ).json()["data"] == ["From partial: freddy"]
          with pytest.raises(FnIndexInferError):
              client.post(
                  "/api/Say_goodbye",
                  json={"data": ["freddy"], "session_hash": "foo"},
              )
  
      with connect(demo) as client:
          assert (
              client.predict("freddy", api_name="/greet")
              == "Hello freddy"
          )
          assert (
              client.predict("freddy", api_name="/goodbye")
              == "Goodbye freddy"
          )
          assert (
              client.predict("freddy", api_name="/greet_me") == "Hello"
          )
          assert (
              client.predict("freddy", api_name="/Say__goodbye")
              == "Goodbye"
          )
  
imports: import functools
  import os
  import tempfile
  from contextlib import asynccontextmanager, closing
  from unittest import mock
  import gradio_client
  import numpy
  import pandas
  import pytest
  import starlette.routing
  from fastapi import FastAPI
  from fastapi.testclient import TestClient
  from gradio_client import media_data
  import gradio
  from gradio import Blocks, Button, Interface, Number, Textbox, close_all, routes, wasm_utils
  from gradio.route_utils import FnIndexInferError
label_desc: Use image node_id 8 for calling a global function with example usage: test_api_name_set_for_all_events(connect) and returns: unknown, unknown, str, str, unknown, unknown, str