示例#1
0
async def test_app_handle_websocket_asyncio_cancelled_error(
    websocket_scope: WebsocketScope,
) -> None:
    app = Quart(__name__)

    @app.websocket("/")
    async def index() -> NoReturn:
        raise asyncio.CancelledError()

    websocket = app.websocket_class(
        "/",
        b"",
        "wss",
        Headers([("host", "quart.com")]),
        "",
        "1.1",
        None,
        None,
        None,
        None,
        None,
        websocket_scope,
    )
    with pytest.raises(asyncio.CancelledError):
        await app.handle_websocket(websocket)
示例#2
0
async def test_app_handle_websocket_asyncio_cancelled_error() -> None:
    app = Quart(__name__)

    @app.websocket("/")
    async def index() -> NoReturn:
        raise asyncio.CancelledError()

    websocket = app.websocket_class("/", b"", "wss", CIMultiDict(), "", "1.1",
                                    None, None, None, None)
    with pytest.raises(asyncio.CancelledError):
        await app.handle_websocket(websocket)