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

Method parse_frame

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

Source from the content-addressed store, hash-verified

38 """WebSocketReader subclass that allows for patching parse_frame."""
39
40 def parse_frame(
41 self, data: bytes
42 ) -> list[tuple[bool, int, bytes | bytearray, int]]:
43 # This method is overridden to allow for patching in tests.
44 frames: list[tuple[bool, int, bytes | bytearray, int]] = []
45
46 def _handle_frame(
47 fin: bool,
48 opcode: int,
49 payload: bytes | bytearray,
50 compressed: int,
51 ) -> None:
52 # This method is overridden to allow for patching in tests.
53 frames.append((fin, opcode, payload, compressed))
54
55 with mock.patch.object(self, "_handle_frame", _handle_frame):
56 self._feed_data(data)
57 return frames
58
59
60def build_frame(

Calls 1

_feed_dataMethod · 0.80

Tested by

no test coverage detected