Skip to content

Commit 131a424

Browse files
committed
fix up tests
1 parent 0099dcf commit 131a424

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

gql/transport/http_multipart_transport.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ def _parse_multipart_part(self, part_data: bytes) -> Optional[ExecutionResult]:
280280
data = self.json_deserialize(body)
281281

282282
# Handle heartbeats - empty JSON objects
283-
if not data or (len(data) == 0):
283+
if not data:
284284
log.debug("Received heartbeat, ignoring")
285285
return None
286286

tests/test_http_multipart_transport.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,22 @@ def create_multipart_response(books, include_heartbeat=False):
3838
for idx, book in enumerate(books):
3939
data = {"data": {"book": book}}
4040
payload = {"payload": data}
41-
part = (
41+
42+
parts.append((
4243
f"--graphql\r\n"
4344
f"Content-Type: application/json\r\n"
4445
f"\r\n"
4546
f"{json.dumps(payload)}\r\n"
46-
)
47-
parts.append(part)
47+
))
4848

4949
# Add heartbeat after first item if requested
5050
if include_heartbeat and idx == 0:
51-
heartbeat_part = (
52-
"--graphql\r\n" "Content-Type: application/json\r\n" "\r\n" "{{}}\r\n"
53-
)
54-
parts.append(heartbeat_part)
51+
parts.append((
52+
"--graphql\r\n"
53+
"Content-Type: application/json\r\n"
54+
"\r\n"
55+
"{}\r\n"
56+
))
5557

5658
# Add end boundary
5759
parts.append("--graphql--\r\n")

0 commit comments

Comments
 (0)