test_send_state.py 651 B

12345678910111213141516171819202122232425
  1. # Copyright (c) Jupyter Development Team.
  2. # Distributed under the terms of the Modified BSD License.
  3. from traitlets import Bool, Tuple, List
  4. from .utils import setup, teardown
  5. from ..widget import Widget
  6. # A widget with simple traits
  7. class SimpleWidget(Widget):
  8. a = Bool().tag(sync=True)
  9. b = Tuple(Bool(), Bool(), Bool(), default_value=(False, False, False)).tag(sync=True)
  10. c = List(Bool()).tag(sync=True)
  11. def test_empty_send_state():
  12. w = SimpleWidget()
  13. w.send_state([])
  14. assert w.comm.messages == []
  15. def test_empty_hold_sync():
  16. w = SimpleWidget()
  17. with w.hold_sync():
  18. pass
  19. assert w.comm.messages == []