code: def test_patch_curdoc_weakref_raises() -> None:
      with bid.patch_curdoc(_doc()):
          with pytest.raises(RuntimeError) as e:
              bid.curdoc()
              assert (
                  str(e)
                  == "Patched curdoc has been previously destroyed"
              )
  
file_path: bokeh/tests/unit/bokeh/io/test_doc.py
imports: from __future__ import annotations
  import pytest
  import weakref
  from bokeh.document import Document
  from bokeh.io.state import curstate
  import bokeh.io.doc
label_desc: Use image node_id 5 for calling a global function with example usage: test_patch_curdoc_weakref_raises() without return types