code: def test_echo(echo):
      # we always echo values back to the frontend if configured
      class ValueWidget(Widget):
          value = Float().tag(sync=True)
  
      widget = ValueWidget(value=1)
      assert widget.value == 1
  
      widget._send = mock.MagicMock()
      # this mimics a state coming from the front end
      widget.set_state({"value": 42, "unexpected_field": 43})
      assert widget.value == 42
  
      # we expect this to be echoed
      msg = {
          "method": "echo_update",
          "state": {"value": 42.0},
          "buffer_paths": [],
      }
      call42 = mock.call(msg, buffers=[])
  
      calls = [call42] if echo else []
      widget._send.assert_has_calls(calls)
  
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 19 for calling a global function with example usage: test_echo(echo) without return types