code: def test_predict_route_is_blocked_if_api_open_false():
      io = Interface(
          lambda x: x, "text", "text", examples=[["freddy"]]
      ).queue(api_open=False)
      app, _, _ = io.launch(prevent_thread_lock=True)
      assert io.show_api
      client = TestClient(app)
      result = client.post(
          "/api/predict",
          json={"fn_index": 0, "data": [5], "session_hash": "foo"},
      )
      assert result.status_code == 404
  
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 2 for calling a global function with example usage: test_predict_route_is_blocked_if_api_open_false() without return types