test_link.py 1005 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. # Copyright (c) Jupyter Development Team.
  2. # Distributed under the terms of the Modified BSD License.
  3. import pytest
  4. from .. import jslink, jsdlink, ToggleButton
  5. from .utils import setup, teardown
  6. def test_jslink_args():
  7. with pytest.raises(TypeError):
  8. jslink()
  9. w1 = ToggleButton()
  10. with pytest.raises(TypeError):
  11. jslink((w1, 'value'))
  12. w2 = ToggleButton()
  13. jslink((w1, 'value'), (w2, 'value'))
  14. with pytest.raises(TypeError):
  15. jslink((w1, 'value'), (w2, 'nosuchtrait'))
  16. with pytest.raises(TypeError):
  17. jslink((w1, 'value'), (w2, 'traits'))
  18. def test_jsdlink_args():
  19. with pytest.raises(TypeError):
  20. jsdlink()
  21. w1 = ToggleButton()
  22. with pytest.raises(TypeError):
  23. jsdlink((w1, 'value'))
  24. w2 = ToggleButton()
  25. jsdlink((w1, 'value'), (w2, 'value'))
  26. with pytest.raises(TypeError):
  27. jsdlink((w1, 'value'), (w2, 'nosuchtrait'))
  28. with pytest.raises(TypeError):
  29. jsdlink((w1, 'value'), (w2, 'traits'))