code: def test_patch_event_contains_setter(self) -> None:
      sample = self._sample_doc()
      root = None
      other_root = None
      for r in sample.roots:
          if r.child is not None:
              root = r
          else:
              other_root = r
      assert root is not None
      assert other_root is not None
      new_child = AnotherModelInTestPatchDoc(bar=56)
  
      cds = ColumnDataSource(data={"a": np.array([0.0, 1.0, 2.0])})
      sample.add_root(cds)
  
      mock_session = object()
  
      def sample_document_callback_assert(event):
          """Asserts that setter is correctly set on event"""
          assert event.setter is mock_session
  
      sample.on_change(sample_document_callback_assert)
  
      # Model property changed
      event = ModelChangedEvent(sample, root, "child", new_child)
      msg = proto.create("PATCH-DOC", [event])
      msg.apply_to_document(sample, mock_session)
      assert msg.buffers == []
  
      # RootAdded
      event2 = RootAddedEvent(sample, root)
      msg2 = proto.create("PATCH-DOC", [event2])
      msg2.apply_to_document(sample, mock_session)
      assert msg2.buffers == []
  
      # RootRemoved
      event3 = RootRemovedEvent(sample, root)
      msg3 = proto.create("PATCH-DOC", [event3])
      msg3.apply_to_document(sample, mock_session)
      assert msg3.buffers == []
  
      # ColumnsStreamed
      event4 = ColumnsStreamedEvent(
          sample, cds, "data", {"a": [3]}, None, mock_session
      )
      msg4 = proto.create("PATCH-DOC", [event4])
      msg4.apply_to_document(sample, mock_session)
      assert msg4.buffers == []
  
      # ColumnsPatched
      event5 = ColumnsPatchedEvent(
          sample, cds, "data", {"a": [(0, 11)]}
      )
      msg5 = proto.create("PATCH-DOC", [event5])
      msg5.apply_to_document(sample, mock_session)
      assert msg5.buffers == []
  
      # ColumnDataChanged
      event7 = ColumnDataChangedEvent(sample, cds, "data")
      msg7 = proto.create("PATCH-DOC", [event7])
      msg7.apply_to_document(sample, mock_session)
      assert len(msg7.buffers) == 1
  
      # reports CDS buffer *as it is* Normally events called by setter and
      # value in local object would have been already mutated.
      [buf] = msg7.buffers
      assert bytes(buf.data) == np.array([11.0, 1.0, 2.0, 3]).tobytes()
  
file_path: bokeh/tests/unit/bokeh/protocol/messages/test_patch_doc.py
imports: from __future__ import annotations
  import pytest
  import numpy
  import bokeh.document
  from bokeh.core.properties import Instance, Int, Nullable
  from bokeh.document.events import ColumnDataChangedEvent, ColumnsPatchedEvent, ColumnsStreamedEvent, ModelChangedEvent, RootAddedEvent, RootRemovedEvent
  from bokeh.model import Model
  from bokeh.models import ColumnDataSource
  from bokeh.protocol import Protocol
label_desc: Use image node_id 6 for calling the TestPatchDocument obj's underlying member method code with example usage: obj.test_patch_event_contains_setter() without return types