From 7edeb3ce6ffcf6d2b146c3638f9e8368eade2dfb Mon Sep 17 00:00:00 2001 From: ilwu <7858970+ilwu@users.noreply.github.com> Date: Mon, 19 Oct 2026 21:32:17 +0800 Subject: [PATCH] tests: compare the error reply of server.py as JSON * test_server_continues_after_client_exception now parses the PIME_MSG reply instead of matching a fixed string. server.py builds the error reply with json.dumps() since f7fed0a, which emits {"success": false} with a space, so the exact-string assertion has been failing on master even though the behaviour is correct. The test now checks the decoded JSON, so the formatting of the reply no longer matters. Generated with assistance from Claude Code (Claude Fable 5.1). Co-Authored-By: Claude Fable 5.1 --- tests/test_backend_resilience.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_backend_resilience.py b/tests/test_backend_resilience.py index 577482c6..5e18ec6b 100644 --- a/tests/test_backend_resilience.py +++ b/tests/test_backend_resilience.py @@ -139,7 +139,9 @@ def handleRequest(self, msg): contextlib.redirect_stderr(io.StringIO()): server.run() - self.assertIn('PIME_MSG|client-1|{"success":false}', stdout.getvalue()) + replies = [line for line in stdout.getvalue().splitlines() if line.startswith("PIME_MSG|client-1|")] + self.assertEqual(len(replies), 1) + self.assertEqual(json.loads(replies[0][len("PIME_MSG|client-1|"):]), {"success": False}) def test_server_ignores_malformed_request_line(self): server_mod = self.import_server()