@@ -363,40 +363,11 @@ async def test_async_extradata_poa_middleware_on_eth_subscription(
363
363
# clean up
364
364
async_w3 .middleware_onion .remove ("poa_middleware" )
365
365
366
- @pytest .mark .asyncio
367
- async def test_public_socket_api (self , async_w3 : "AsyncWeb3" ) -> None :
368
- async_w3 .provider ._request_processor .clear_caches ()
369
-
370
- # send a request over the socket
371
- await async_w3 .socket .send (
372
- RPCEndpoint ("eth_getBlockByNumber" ), ["latest" , True ]
373
- )
374
-
375
- # recv and validate the unprocessed response
376
- response = await async_w3 .socket .recv ()
377
- assert "id" in response , "Expected 'id' key in response."
378
- assert "jsonrpc" in response , "Expected 'jsonrpc' key in response."
379
- assert "result" in response , "Expected 'result' key in response."
380
- assert all (k in response ["result" ].keys () for k in SOME_BLOCK_KEYS )
381
- assert not isinstance (response ["result" ]["number" ], int ) # assert not processed
382
-
383
- # make a request over the socket
384
- response = await async_w3 .socket .make_request (
385
- RPCEndpoint ("eth_getBlockByNumber" ), ["latest" , True ]
386
- )
387
- assert "id" in response , "Expected 'id' key in response."
388
- assert "jsonrpc" in response , "Expected 'jsonrpc' key in response."
389
- assert "result" in response , "Expected 'result' key in response."
390
- assert all (k in response ["result" ].keys () for k in SOME_BLOCK_KEYS )
391
- assert not isinstance (response ["result" ]["number" ], int ) # assert not processed
392
-
393
366
@pytest .mark .asyncio
394
367
async def test_asyncio_gather_for_multiple_requests_matches_the_responses (
395
368
self ,
396
369
async_w3 : "AsyncWeb3" ,
397
370
) -> None :
398
- async_w3 .provider ._request_processor .clear_caches ()
399
-
400
371
(
401
372
latest ,
402
373
chain_id ,
@@ -427,3 +398,28 @@ async def test_asyncio_gather_for_multiple_requests_matches_the_responses(
427
398
assert isinstance (chain_id , int )
428
399
assert isinstance (chain_id2 , int )
429
400
assert isinstance (chain_id3 , int )
401
+
402
+ @pytest .mark .asyncio
403
+ async def test_public_socket_api (self , async_w3 : "AsyncWeb3" ) -> None :
404
+ # send a request over the socket
405
+ await async_w3 .socket .send (
406
+ RPCEndpoint ("eth_getBlockByNumber" ), ["latest" , True ]
407
+ )
408
+
409
+ # recv and validate the unprocessed response
410
+ response = await async_w3 .socket .recv ()
411
+ assert "id" in response , "Expected 'id' key in response."
412
+ assert "jsonrpc" in response , "Expected 'jsonrpc' key in response."
413
+ assert "result" in response , "Expected 'result' key in response."
414
+ assert all (k in response ["result" ].keys () for k in SOME_BLOCK_KEYS )
415
+ assert not isinstance (response ["result" ]["number" ], int ) # assert not processed
416
+
417
+ # make a request over the socket
418
+ response = await async_w3 .socket .make_request (
419
+ RPCEndpoint ("eth_getBlockByNumber" ), ["latest" , True ]
420
+ )
421
+ assert "id" in response , "Expected 'id' key in response."
422
+ assert "jsonrpc" in response , "Expected 'jsonrpc' key in response."
423
+ assert "result" in response , "Expected 'result' key in response."
424
+ assert all (k in response ["result" ].keys () for k in SOME_BLOCK_KEYS )
425
+ assert not isinstance (response ["result" ]["number" ], int ) # assert not processed
0 commit comments