test_link.py
39 lines
| 1.0 KiB
| text/x-python
|
PythonLexer
Min RK
|
r20185 | # Copyright (c) IPython Development Team. | ||
# Distributed under the terms of the Modified BSD License. | ||||
import nose.tools as nt | ||||
Min RK
|
r20230 | from .. import jslink, jsdlink, ToggleButton | ||
Min RK
|
r20185 | from .test_interaction import setup, teardown | ||
Min RK
|
r20230 | def test_jslink_args(): | ||
Min RK
|
r20185 | with nt.assert_raises(TypeError): | ||
Min RK
|
r20230 | jslink() | ||
Min RK
|
r20185 | w1 = ToggleButton() | ||
with nt.assert_raises(TypeError): | ||||
Min RK
|
r20230 | jslink((w1, 'value')) | ||
Min RK
|
r20185 | |||
w2 = ToggleButton() | ||||
Min RK
|
r20230 | jslink((w1, 'value'), (w2, 'value')) | ||
Min RK
|
r20185 | |||
with nt.assert_raises(TypeError): | ||||
Min RK
|
r20230 | jslink((w1, 'value'), (w2, 'nosuchtrait')) | ||
Min RK
|
r20185 | |||
with nt.assert_raises(TypeError): | ||||
Min RK
|
r20230 | jslink((w1, 'value'), (w2, 'traits')) | ||
Min RK
|
r20185 | |||
Min RK
|
r20230 | def test_jsdlink_args(): | ||
Min RK
|
r20185 | with nt.assert_raises(TypeError): | ||
Min RK
|
r20230 | jsdlink() | ||
Min RK
|
r20185 | w1 = ToggleButton() | ||
with nt.assert_raises(TypeError): | ||||
Min RK
|
r20230 | jsdlink((w1, 'value')) | ||
Min RK
|
r20185 | |||
w2 = ToggleButton() | ||||
Min RK
|
r20230 | jsdlink((w1, 'value'), (w2, 'value')) | ||
Min RK
|
r20185 | |||
with nt.assert_raises(TypeError): | ||||
Min RK
|
r20230 | jsdlink((w1, 'value'), (w2, 'nosuchtrait')) | ||
Min RK
|
r20185 | |||
with nt.assert_raises(TypeError): | ||||
Min RK
|
r20230 | jsdlink((w1, 'value'), (w2, 'traits')) | ||