From 33d8ac3046c6b06eae58ef3ff9a1515778bb28c4 Mon Sep 17 00:00:00 2001 From: OpenBot Date: Tue, 6 Oct 2026 11:07:14 +0800 Subject: [PATCH] test: fix ndjson partial-tail truncation point --- tests/test_ndjson.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_ndjson.py b/tests/test_ndjson.py index 5b711a9..df4d44e 100644 --- a/tests/test_ndjson.py +++ b/tests/test_ndjson.py @@ -16,8 +16,9 @@ def test_ndjson_roundtrip(): def test_ndjson_partial_tail(): a = {"id": 1} - b = {"id": 2} - buf = encode_ndjson(a) + encode_ndjson(b)[:10] # b is incomplete + b = {"id": 2, "payload": "x" * 50} + b_full = encode_ndjson(b) + buf = encode_ndjson(a) + b_full[:-1] # b truncated before its newline msgs, consumed = decode_ndjson_lines(buf) assert msgs == [a] assert consumed == len(encode_ndjson(a))