示例#1
0
def test_validate_callbacks_raises():
    callbacks = [Logger(), SplineRegularizer(), 'not a callback']
    with pytest.raises(TypeError) as excinfo:
        validate_callbacks(callbacks)

    err_msg = 'Found non-callback object in callbacks: {}'.format(
        ['not a callback'])
    assert err_msg == str(excinfo.value)
示例#2
0
def test_validate_empty_callbacks():
    assert validate_callbacks(None) == []
示例#3
0
def test_validate_callbacks_single_callback(callback):
    validate_callbacks(callback) == [callback]
示例#4
0
def test_validate_callbacks():
    callbacks = [Logger(), SplineRegularizer()]
    assert validate_callbacks(callbacks) == callbacks