Skip to content

Commit 2ec34c8

Browse files
Adjust comments
1 parent ff5c54d commit 2ec34c8

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

tests/test_base_client.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -287,29 +287,26 @@ def inner(h: BaseHTTPRequestHandler):
287287
def test_streaming_response_chunk_size(chunk_size, expected_chunks, data_size):
288288
test_data = b"0" * data_size
289289
content_chunks = []
290-
290+
291291
mock_response = Mock(spec=requests.Response)
292292
def mock_iter_content(chunk_size):
293-
# Simulate how requests would chunk the data
293+
# Simulate how requests would chunk the data.
294294
for i in range(0, len(test_data), chunk_size):
295295
chunk = test_data[i:i + chunk_size]
296-
content_chunks.append(chunk) # Track chunks for verification
296+
content_chunks.append(chunk) # track chunks for verification
297297
yield chunk
298-
299298
mock_response.iter_content = mock_iter_content
300-
301-
# Create streaming response and set chunk size
302299
stream = _StreamingResponse(mock_response)
303300
stream.set_chunk_size(chunk_size)
304301

305-
# Read all data
302+
# Read all data one byte at a time.
306303
received_data = b""
307304
while True:
308305
chunk = stream.read(1)
309306
if not chunk:
310307
break
311308
received_data += chunk
312309

313-
assert received_data == test_data # All data was received correctly
314-
assert len(content_chunks) == expected_chunks # Correct number of chunks
315-
assert all(len(c) <= chunk_size for c in content_chunks) # Chunks don't exceed size
310+
assert received_data == test_data # all data was received correctly
311+
assert len(content_chunks) == expected_chunks # correct number of chunks
312+
assert all(len(c) <= chunk_size for c in content_chunks) # chunks don't exceed size

0 commit comments

Comments
 (0)