code: def test_model_inference_api_mock(monkeypatch):
      monkeypatch.setattr(serve, "uvicorn", MagicMock())
      comp = EmptyServer()
      comp.run()
      serve.uvicorn.run.assert_called_once_with(
          app=ANY, host=comp.host, port=comp.port, log_level="error"
      )
  
      with pytest.raises(Exception, match="Only input in"):
          EmptyServer(input="something")
  
      with pytest.raises(Exception, match="Only output in"):
          EmptyServer(output="something")
  
imports: import base64
  import multiprocessing
  import os
  from unittest.mock import ANY, MagicMock
  import pytest
  from lightning.app.components.serve import serve
  from lightning.app.testing.helpers import _RunIf
  from lightning.app.utilities.imports import _is_numpy_available, _is_torch_available
  from lightning.app.utilities.network import _configure_session, find_free_network_port
  from tests_app import _PROJECT_ROOT
label_desc: Use image node_id 3 for calling a global function with example usage: test_model_inference_api_mock(monkeypatch) without return types