From f9fceba8392478c0d5e90ec916cf108d04b274cc Mon Sep 17 00:00:00 2001 From: cacosandon Date: Wed, 4 Sep 2024 08:31:59 -0400 Subject: [PATCH] lint: fix flake8 errors --- tests/test_generic_websocket.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tests/test_generic_websocket.py b/tests/test_generic_websocket.py index c3e7022d..0ade1a02 100644 --- a/tests/test_generic_websocket.py +++ b/tests/test_generic_websocket.py @@ -486,6 +486,7 @@ async def connect(self): assert msg["code"] == 4007 assert msg["reason"] == "test reason" + @pytest.mark.django_db @pytest.mark.asyncio async def test_websocket_receive_with_none_text(): @@ -507,8 +508,15 @@ def receive(self, text_data=None, bytes_data=None): connected, _ = await communicator.connect() assert connected - # Simulate Hypercorn behavior (both 'text' and 'bytes' keys present, but 'text' is None) - await communicator.send_input({"type": "websocket.receive", "text": None, "bytes": b"test data"}) + # Simulate Hypercorn behavior + # (both 'text' and 'bytes' keys present, but 'text' is None) + await communicator.send_input( + { + "type": "websocket.receive", + "text": None, + "bytes": b"test data", + } + ) response = await communicator.receive_output() assert response["type"] == "websocket.send" assert response["text"] == "Received bytes of length: 9" @@ -520,7 +528,9 @@ def receive(self, text_data=None, bytes_data=None): assert response["text"] == "Received bytes of length: 9" # Test with valid text data - await communicator.send_input({"type": "websocket.receive", "text": "Hello, world!"}) + await communicator.send_input( + {"type": "websocket.receive", "text": "Hello, world!"} + ) response = await communicator.receive_output() assert response["type"] == "websocket.send" assert response["text"] == "Received text: Hello, world!"