def test_calvin_cb_class():
    func = Mock()
    cb = CalvinCB(func)

    func2 = Mock()
    cb2 = CalvinCB(func2)

    cb = CalvinCBClass(callbacks={'f': [cb]})
    assert 'f' in cb.callback_valid_names()

    cb.callback_register('f2', cb2)
    assert 'f2' in cb.callback_valid_names()

    cb.callback_unregister(cb2.id)
    assert 'f2' not in cb.callback_valid_names()

    cb._callback_execute('f', 1, 2, a=3)
    func.assert_called_with(1, 2, a=3)
dataset/ETHPy150Open EricssonResearch/calvin-base/calvin/tests/test_calvin_callback.py/test_calvin_cb_class/original