| 681 | ], |
| 682 | ) |
| 683 | async def test_aiohttp_websocket_close_frame(msg_type: str) -> None: |
| 684 | class DummyWS(ClientWebSocketResponse): |
| 685 | def __init__(self) -> None: |
| 686 | pass |
| 687 | |
| 688 | @property |
| 689 | def close_code(self) -> None: |
| 690 | return None |
| 691 | |
| 692 | @property |
| 693 | def closed(self) -> bool: |
| 694 | return True |
| 695 | |
| 696 | async def receive(self, timeout: float | None = None) -> WSMessage: # noqa: ASYNC109 |
| 697 | return WSMessage(type=WSMsgType[msg_type], data=None, extra=None) |
| 698 | |
| 699 | async with ClientSession() as session: |
| 700 | ws = AiohttpWebSocket( |
| 701 | request=Request("GET", "ws://example.com"), |
| 702 | session=session, |
| 703 | websocket=DummyWS(), |
| 704 | ) |
| 705 | |
| 706 | with pytest.raises(WebSocketClosed, match=r"code=1006"): |
| 707 | await ws.receive() |
| 708 | |
| 709 | |
| 710 | def test_timeout_unset_vs_none(): |