From 3d11b8e9d4e78343cb16652c49bbb12b5795d1ee Mon Sep 17 00:00:00 2001 From: ishaanxgupta <124028055+ishaanxgupta@users.noreply.github.com> Date: Mon, 9 Mar 2026 05:37:49 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=AA=20[Testing]=20Add=20edge=20case=20?= =?UTF-8?q?test=20for=20short=20text=20parts=20in=20parse=5Fraw=5Fresponse?= =?UTF-8?q?=5Fto=5Fclassifications?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/unit/utils/test_text.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/unit/utils/test_text.py b/tests/unit/utils/test_text.py index 44a8629..fdfed67 100644 --- a/tests/unit/utils/test_text.py +++ b/tests/unit/utils/test_text.py @@ -56,3 +56,25 @@ def test_empty_and_trivial_input(self): assert parse_raw_response_to_classifications("") == [] assert parse_raw_response_to_classifications("(empty)") == [] + + def test_short_parts_edge_case(self): + """ + Tests the edge case where parts < 2. + This branch is normally unreachable with standard strings because we previously + ensure that LLM_TAB_SEPARATOR is in the line. + We test it using a mock object that overrides __contains__ and split. + """ + class MockStr(str): + def __contains__(self, item): + return True + def split(self, *args, **kwargs): + return ["single_part"] + + class MockContent: + def strip(self): + return self + def splitlines(self): + return [MockStr("dummy")] + + result = parse_raw_response_to_classifications(MockContent()) + assert result == []