File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -272,9 +272,28 @@ async def test_response_id_non_canonical_numeric_string_no_match():
272272 server_read , server_write = server_streams
273273
274274 async def mock_server ():
275- """Receive two requests and reply with a colliding non-canonical ID."""
276- await server_read .receive () # request id 0
277- await server_read .receive () # request id 1
275+ """Respond to ping #1, then send a non-canonical ID for ping #2."""
276+ first_message = await server_read .receive ()
277+ assert isinstance (first_message , SessionMessage )
278+ assert isinstance (first_message .message , JSONRPCRequest )
279+ first_request_id = first_message .message .id
280+
281+ # Let the first request complete so the second request is sent.
282+ await server_write .send (
283+ SessionMessage (
284+ message = JSONRPCResponse (
285+ jsonrpc = "2.0" ,
286+ id = first_request_id ,
287+ result = {},
288+ )
289+ )
290+ )
291+
292+ second_message = await server_read .receive ()
293+ assert isinstance (second_message , SessionMessage )
294+ assert isinstance (second_message .message , JSONRPCRequest )
295+ second_request_id = second_message .message .id
296+ assert second_request_id == 1
278297
279298 response = JSONRPCResponse (
280299 jsonrpc = "2.0" ,
You can’t perform that action at this time.
0 commit comments