def test_signal_handler(self, original_handler): clients = [mock.MagicMock(), mock.MagicMock()] client.connected_clients = clients[:] client.connected_clients[0].is_asyncio_based.return_value = False client.connected_clients[1].is_asyncio_based.return_value = True client.signal_handler('sig', 'frame') clients[0].disconnect.assert_called_once_with(abort=True) clients[1].start_background_task.assert_called_once_with( clients[1].disconnect, abort=True)