(
self, data: bytes
)
| 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 | |
| 60 | def build_frame( |
no test coverage detected