@@ -88,44 +88,6 @@ def edge_case_inputs() -> dict[str, str]:
8888 }
8989
9090
91- def setup_sse_content_mock (
92- mock_response : Mock ,
93- chunks : list [tuple [bytes , bytes ]],
94- timestamps : list [int ] | None = None ,
95- ) -> None :
96- """Setup SSE content mock with chunks and timing."""
97- num_chunks = len (chunks )
98- mock_response .content .at_eof .side_effect = [False ] * num_chunks + [True ]
99-
100- read_calls = [chunk [0 ] for chunk in chunks ]
101- readuntil_calls = [chunk [1 ] for chunk in chunks ]
102-
103- mock_response .content .read = AsyncMock (side_effect = read_calls )
104- mock_response .content .readuntil = AsyncMock (side_effect = readuntil_calls )
105-
106-
107- def setup_single_sse_chunk (
108- mock_response : Mock ,
109- first_byte : bytes = b"d" ,
110- remaining : bytes = b"ata: Hello\n \n " ,
111- ) -> None :
112- """Setup a single SSE chunk for testing."""
113- setup_sse_content_mock (mock_response , [(first_byte , remaining )])
114-
115-
116- def create_sse_chunk_list (messages : list [str ]) -> list [tuple [bytes , bytes ]]:
117- """Create SSE chunk list from messages."""
118- chunks = []
119- for message in messages :
120- # Split on first space to separate data: from content
121- if message .startswith ("data: " ):
122- remaining_content = message [6 :] # Remove "data: " prefix
123- chunks .append ((b"d" , f"ata: { remaining_content } \n \n " .encode ()))
124- else :
125- chunks .append ((b"d" , f"ata: { message } \n \n " .encode ()))
126- return chunks
127-
128-
12991@pytest .fixture
13092def user_config () -> UserConfig :
13193 """Fixture providing a sample UserConfig."""
@@ -188,16 +150,6 @@ def mock_sse_response() -> Mock:
188150 )
189151
190152
191- @pytest .fixture
192- def sample_sse_chunks () -> list [tuple [bytes , bytes ]]:
193- """Fixture providing sample SSE chunks as (first_byte, remaining_chunk) tuples."""
194- return [
195- (b"d" , b"ata: Hello\n event: message\n \n " ),
196- (b"d" , b"ata: World\n id: msg-2\n \n " ),
197- (b"d" , b"ata: [DONE]\n \n " ),
198- ]
199-
200-
201153@pytest .fixture
202154def socket_factory_setup ():
203155 """Fixture providing common socket factory test setup."""
0 commit comments