code: def test_build_model():
      import streamlit as st
  
      st.session_state = {}
      st.spinner = mock.MagicMock()
  
      class TestState:
          test_variable = 1
  
      patched_work = _PatchedWork(TestState(), ServeStreamlitTest)
      patched_work.build_model = mock.MagicMock(
          return_value="test_model"
      )
  
      _build_model(patched_work)
  
      assert st.session_state["_model"] == "test_model"
      assert patched_work.model == "test_model"
      patched_work.build_model.assert_called_once()
  
      patched_work.build_model.reset_mock()
  
      _build_model(patched_work)
  
      patched_work.build_model.assert_not_called()
  
file_path: pytorch-lightning/tests/tests_app/components/serve/test_streamlit.py
imports: import os
  import sys
  from unittest import mock
  import lightning.app
  import pytest
  from lightning.app.components.serve.streamlit import ServeStreamlit, _build_model, _PatchedWork
  from lightning_utilities.core.imports import RequirementCache
label_desc: Use image node_id 3 for calling a global function with example usage: test_build_model() without return types