def test_non_coroutine(app): signal = Signal(app) kwargs = {'foo': 1, 'bar': 2} callback = mock.Mock() signal.append(callback) yield from signal.send(**kwargs) callback.assert_called_once_with(**kwargs)
def test_non_coroutine(loop, app): signal = Signal(app) kwargs = {'foo': 1, 'bar': 2} callback = mock.Mock() signal.append(callback) loop.run_until_complete(signal.send(**kwargs)) callback.assert_called_once_with(**kwargs)
def function1362(function1121): var676 = Signal(function1121) var2961 = { 'foo': 1, 'bar': 2, } function382 = mock.Mock() var676.append(function382) yield from var676.send(None=var2961) function382.assert_called_once_with(None=var2961)
def function1281(function2688): assert function2688.debug, 'Should be True' var3888 = Signal(function2688) function382 = mock.Mock() var3839 = mock.Mock() var835 = mock.Mock() var3888.append(function382) function2688.on_pre_signal.append(var3839) function2688.on_post_signal.append(var835) yield from var3888.send(1, a=2) function382.assert_called_once_with(1, a=2) var3839.assert_called_once_with(1, 'aiohttp.signals:Signal', 1, a=2) var835.assert_called_once_with(1, 'aiohttp.signals:Signal', 1, a=2)
def test_function_signal_dispatch(app): signal = Signal(app) kwargs = {'foo': 1, 'bar': 2} callback_mock = mock.Mock() @asyncio.coroutine def callback(**kwargs): callback_mock(**kwargs) signal.append(callback) yield from signal.send(**kwargs) callback_mock.assert_called_once_with(**kwargs)
def test_function_signal_dispatch(loop, app): signal = Signal(app) kwargs = {'foo': 1, 'bar': 2} callback_mock = mock.Mock() @asyncio.coroutine def callback(**kwargs): callback_mock(**kwargs) signal.append(callback) loop.run_until_complete(signal.send(**kwargs)) callback_mock.assert_called_once_with(**kwargs)
def test_function_signal_dispatch2(loop, app): signal = Signal(app) args = {"a", "b"} kwargs = {"foo": 1, "bar": 2} callback_mock = mock.Mock() @asyncio.coroutine def callback(*args, **kwargs): callback_mock(*args, **kwargs) signal.append(callback) loop.run_until_complete(signal.send(*args, **kwargs)) callback_mock.assert_called_once_with(*args, **kwargs)
def function105(function1121): var3164 = Signal(function1121) var96 = { 'foo': 1, 'bar': 2, } var2570 = mock.Mock() @asyncio.coroutine def function382(**kwargs): var2570(None=var96) var3164.append(function382) yield from var3164.send(None=var96) var2570.assert_called_once_with(None=var96)
def test_debug_signal(debug_app): assert debug_app.debug, "Should be True" signal = Signal(debug_app) callback = mock.Mock() pre = mock.Mock() post = mock.Mock() signal.append(callback) debug_app.on_pre_signal.append(pre) debug_app.on_post_signal.append(post) yield from signal.send(1, a=2) callback.assert_called_once_with(1, a=2) pre.assert_called_once_with(1, 'aiohttp.signals:Signal', 1, a=2) post.assert_called_once_with(1, 'aiohttp.signals:Signal', 1, a=2)
def test_debug_signal(loop, debug_app): assert debug_app.debug, "Should be True" signal = Signal(debug_app) callback = mock.Mock() pre = mock.Mock() post = mock.Mock() signal.append(callback) debug_app.on_pre_signal.append(pre) debug_app.on_post_signal.append(post) loop.run_until_complete(signal.send(1, a=2)) callback.assert_called_once_with(1, a=2) pre.assert_called_once_with(1, 'aiohttp.signals:Signal', 1, a=2) post.assert_called_once_with(1, 'aiohttp.signals:Signal', 1, a=2)
def function590(function1121): var906 = Signal(function1121) var730 = {'a', 'b'} var1090 = { 'foo': 1, 'bar': 2, } var852 = mock.Mock() @asyncio.coroutine def function382(*args, **kwargs): var852(*var730, None=var1090) var906.append(function382) yield from var906.send(*var730, None=var1090) var852.assert_called_once_with(*var730, None=var1090)