code: def test_state_access():
      def script():
          import streamlit as st
  
          if "foo" not in st.session_state:
              st.session_state.foo = "bar"
          st.write(st.session_state.foo)
  
      at = AppTest.from_function(script).run()
      assert at.markdown[0].value == "bar"
  
      at.session_state["foo"] = "baz"
      at.run()
      assert at.markdown[0].value == "baz"
  
      at.session_state.foo = "quux"
      at.run()
      assert at.markdown[0].value == "quux"
  
imports: from datetime import date, datetime, time
  import numpy
  import pandas
  import pytest
  from streamlit.elements.markdown import MARKDOWN_HORIZONTAL_RULE_EXPRESSION
  from streamlit.testing.v1.app_test import AppTest
label_desc: Use image node_id 39 for calling a global function with example usage: test_state_access() without return types