1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
"""
Batch Reading Integration Tests
Tests for batch reading functionality with GIL management.
Validates that read_batch() correctly returns batches of records
with proper capacity limit enforcement.
"""
"""Test batch reading functionality."""
"""
Acceptance Test: read_batch() returns up to 100 records in single GIL cycle.
This test verifies:
- Reader can iterate through records efficiently
- No exceptions during reading
- All records are delivered
"""
=
= 0
+= 1
assert is not None
# fixture_1k has 1000 records, so we should read all of them
assert == 1000, f
"""
Verify StopIteration is idempotent after EOF.
After reaching EOF, subsequent iteration attempts should
raise StopIteration without additional I/O.
"""
=
# Consume all records
=
assert == 1000
# Attempting to read again should not raise any errors
# (the reader is consumed, but iteration is safe)
=
assert == 0
"""
Nominal case - batch size of 100 should handle 10k records efficiently.
With 10,000 records and batch_size=100, should read cleanly in 100 batches.
"""
=
= 0
+= 1
# fixture_10k has 10,000 records
assert == 10000
"""Test hard capacity limits (200 records, 300KB per batch)."""
"""
Verify hard limit on batch capacity (200 records OR 300KB).
Even if batch_size=100, the implementation has hard stops at:
- 200 records per batch
- 300 KB per batch
Reading 10k records should still work correctly with hard limits.
"""
=
= 0
+= 1
# All records must be delivered despite hard limits
# (limits only affect batching, not final delivery)
assert == 10000
"""Test GIL contract for batch reading."""
"""
GIL Contract: Verify batch reading completes without deadlock.
This is a smoke test - actual threading tests are in separate suite.
If GIL is held throughout, this would hang in actual threaded scenarios.
"""
=
# Simple test that reading completes without hanging
=
assert == 1000