code: def test_set_state_transformer(echo):
      w = TransformerWidget()
      w.set_state(dict(d=[True, False, True]))
      # Since the deserialize step changes the state, this should send an update
      expected = []
      if echo:
          expected.append(
              (
                  (),
                  dict(
                      buffers=[],
                      data=dict(
                          buffer_paths=[],
                          method="echo_update",
                          state=dict(d=[True, False, True]),
                      ),
                  ),
              )
          )
      expected.append(
          (
              (),
              dict(
                  buffers=[],
                  data=dict(
                      buffer_paths=[],
                      method="update",
                      state=dict(d=[False, True, False]),
                  ),
              ),
          )
      )
      assert w.comm.messages == expected
  
imports: import pytest
  from traitlets import Bool, Tuple, List, Instance, CFloat, CInt, Float, Int, TraitError, observe
  from .utils import setup, teardown
  import ipywidgets
  from ipywidgets import Widget
label_desc: Use image node_id 8 for calling a global function with example usage: test_set_state_transformer(echo) without return types