From dfc5913c5ea3ffd9b7b4f010fb7cb3a0cddc2e08 Mon Sep 17 00:00:00 2001 From: Hyungi Ahn Date: Sat, 2 May 2026 08:35:34 +0900 Subject: [PATCH] =?UTF-8?q?fix(tests):=20explanation=20cap=20test=20setup?= =?UTF-8?q?=20=E2=80=94=20=ED=95=9C=EA=B8=80=20chunk=20=EA=B8=B8=EC=9D=B4?= =?UTF-8?q?=20=EB=B6=80=EC=A1=B1=20=EB=B3=B4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit case 3/4 의 setup 이 EXPLANATION_MAX_CHARS (1200) 보다 작은 text 를 만들어 assert 실패. 한글 chunk 반복 횟수 늘려 1200 자 이상 보장. Co-Authored-By: Claude Opus 4.7 (1M context) --- tests/test_explanation_cap.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/test_explanation_cap.py b/tests/test_explanation_cap.py index 79892f9..edd9dcd 100644 --- a/tests/test_explanation_cap.py +++ b/tests/test_explanation_cap.py @@ -30,10 +30,10 @@ def test_cap_exactly_at_limit(): def test_cap_long_text_with_paragraph_boundary(): - """1500자 + 마지막 200자 안에 \\n\\n 있으면 거기서 자르기 + …""" - head = "정답 풀이 본문. " * 60 # ~1200자 - boundary_pos = 1100 - text = head[:boundary_pos] + "\n\n" + "추가 단락 본문." * 50 # 1500자+ + """긴 텍스트 + 마지막 200자 안에 \\n\\n 있으면 거기서 자르기 + …""" + head = "정답 풀이 본문 그리고 추가 설명. " * 100 # 충분히 긴 head + boundary_pos = 1100 # cap (1200) 의 마지막 200 안 + text = head[:boundary_pos] + "\n\n" + ("추가 단락 본문이 더 들어갑니다. " * 50) assert len(text) > EXPLANATION_MAX_CHARS capped = _cap_explanation_md(text) assert len(capped) <= EXPLANATION_MAX_CHARS + 1 # + "…" @@ -41,9 +41,9 @@ def test_cap_long_text_with_paragraph_boundary(): def test_cap_long_text_with_sentence_boundary(): - """\\n\\n 이 없으면 마침표에서 자르기.""" - parts = ["문장 한 개가 약간 깁니다. " for _ in range(100)] - text = "".join(parts) # 약 2400자 + """\\n\\n 이 없으면 마침표 / "다." / "요." 에서 자르기.""" + parts = ["이 문장은 약간 길게 만든 것입니다. " for _ in range(200)] + text = "".join(parts) assert len(text) > EXPLANATION_MAX_CHARS capped = _cap_explanation_md(text) assert len(capped) <= EXPLANATION_MAX_CHARS + 1