code: def test_envset_restores() -> None:
      if "foo" in os.environ:
          old_foo = os.environ["foo"]
          os.environ["foo"] = "123"
          with _tue.envset(foo="10"):
              pass
          assert os.environ["foo"] == "123"
          os.environ["foo"] = old_foo
      else:
          os.environ["foo"] = "123"
          with _tue.envset(foo="10"):
              pass
          assert os.environ["foo"] == "123"
          del os.environ["foo"]
  
file_path: bokeh/tests/unit/bokeh/_testing/util/test_env.py
imports: from __future__ import annotations
  import pytest
  import os
  from tests.support.util.api import verify_all
  import tests.support.util.env
label_desc: Use image node_id 2 for calling a global function with example usage: test_envset_restores() without return types