@@ -557,7 +557,7 @@ def test_invalid_json_shape_is_not_retried(self):
557557 """Malformed JSON-RPC is not safe to retry."""
558558 import mempalace_mcp_proxy as proxy
559559
560- body = b' not json'
560+ body = b" not json"
561561 assert not proxy ._is_retry_safe (body )
562562
563563 def test_missing_jsonrpc_field_is_not_retried (self ):
@@ -612,9 +612,7 @@ def test_final_5xx_with_json_body_is_failure_and_preserves_status(self):
612612 FakeResponse (503 , b"{}" ),
613613 FakeResponse (
614614 503 ,
615- json .dumps (
616- {"jsonrpc" : "2.0" , "id" : 1 , "error" : {"code" : - 32000 }}
617- ).encode (),
615+ json .dumps ({"jsonrpc" : "2.0" , "id" : 1 , "error" : {"code" : - 32000 }}).encode (),
618616 ),
619617 ],
620618 restore_circuit = False ,
@@ -737,9 +735,7 @@ def test_repeated_json_5xx_opens_circuit_and_persists_status(self):
737735 body = json .dumps (
738736 {"jsonrpc" : "2.0" , "id" : 1 , "method" : "tools/list" , "params" : {}}
739737 ).encode ()
740- upstream_body = json .dumps (
741- {"jsonrpc" : "2.0" , "id" : 1 , "error" : {"code" : - 32000 }}
742- ).encode ()
738+ upstream_body = json .dumps ({"jsonrpc" : "2.0" , "id" : 1 , "error" : {"code" : - 32000 }}).encode ()
743739
744740 async def test ():
745741 # Reset proxy state for a clean circuit.
@@ -940,7 +936,10 @@ async def post(self, *args, **kwargs):
940936 (b"null" , "null" ),
941937 (b'"string"' , "string" ),
942938 (b"123" , "number" ),
943- (b'[{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}, {"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}]' , "batch array" ),
939+ (
940+ b'[{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}, {"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}]' ,
941+ "batch array" ,
942+ ),
944943 ]
945944 for body , label in cases :
946945 resp = await client .post ("/mcp" , data = body )
@@ -993,7 +992,9 @@ async def aclose(self):
993992
994993 async def post (self , * args , ** kwargs ):
995994 CountingClient .calls += 1
996- return FakeResponse (200 , json .dumps ({"jsonrpc" : "2.0" , "id" : 1 , "result" : []}).encode ())
995+ return FakeResponse (
996+ 200 , json .dumps ({"jsonrpc" : "2.0" , "id" : 1 , "result" : []}).encode ()
997+ )
997998
998999 proxy ._http_client = CountingClient ()
9991000
0 commit comments