MCPcopy Create free account
hub / github.com/aio-libs/aiohttp / parse_frame

Method parse_frame

tests/test_websocket_parser.py:29–46  ·  view source on GitHub ↗
(
        self, data: bytes
    )

Source from the content-addressed store, hash-verified

27 """WebSocketReader subclass that allows for patching parse_frame."""
28
29 def parse_frame(
30 self, data: bytes
31 ) -> list[tuple[bool, int, bytes | bytearray, int]]:
32 # This method is overridden to allow for patching in tests.
33 frames: list[tuple[bool, int, bytes | bytearray, int]] = []
34
35 def _handle_frame(
36 fin: bool,
37 opcode: int,
38 payload: bytes | bytearray,
39 compressed: int,
40 ) -> None:
41 # This method is overridden to allow for patching in tests.
42 frames.append((fin, opcode, payload, compressed))
43
44 with mock.patch.object(self, "_handle_frame", _handle_frame):
45 self._feed_data(data)
46 return frames
47
48
49def build_frame(

Calls 1

_feed_dataMethod · 0.45

Tested by

no test coverage detected