code: def test_interface_adds_stop_button(
      interface_type, live, use_generator
  ):
      def gen_func(inp):
          yield inp
  
      def func(inp):
          return inp
  
      if interface_type == "standard":
          interface = gradio.Interface(
              gen_func if use_generator else func,
              "number",
              "number",
              live=live,
          )
      elif interface_type == "input_only":
          interface = gradio.Interface(
              gen_func if use_generator else func,
              "number",
              None,
              live=live,
          )
      elif interface_type == "output_only":
          interface = gradio.Interface(
              gen_func if use_generator else func,
              None,
              "number",
              live=live,
          )
      else:
          num = gradio.Number()
          interface = gradio.Interface(
              gen_func if use_generator else func, num, num, live=live
          )
      has_stop = (
          len(
              [
                  c
                  for c in interface.config["components"]
                  if c["props"].get("variant", "") == "stop"
              ]
          )
          == 1
      )
      if use_generator and not live:
          assert has_stop
      else:
          assert not has_stop
  
imports: import io
  import sys
  import unittest.mock
  from contextlib import contextmanager
  from functools import partial
  from string import capwords
  import httpx
  import pytest
  import gradio
  from gradio.blocks import Blocks
  from gradio.components import Image, Textbox
  from gradio.interface import Interface, TabbedInterface, close_all, os
  from gradio.layouts import TabItem, Tabs
  from gradio.utils import assert_configs_are_equivalent_besides_ids
label_desc: Use image node_id 2 for calling a global function with example usage: test_interface_adds_stop_button(interface_type, live, use_generator) and returns: inp