Python traitlets.CInt() Examples

The following are 1 code examples of traitlets.CInt(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module traitlets , or try the search function .
Example #1
Source File: test_set_state.py    From pySINDy with MIT License 6 votes vote down vote up
def test_set_state_cint_to_float():
    w = NumberWidget()

    # Set CInt to float
    w.set_state(dict(
        ci = 5.6
    ))
    # Ensure an update message gets produced
    nt.assert_equal(len(w.comm.messages), 1)
    msg = w.comm.messages[0]
    data = msg[1]['data']
    assert data['method'] == 'update'
    assert data['state'] == {'ci': 5}


# This test is disabled, meaning ipywidgets REQUIRES
# any JSON received to format int-like numbers as ints