Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions tests/unit/utils/test_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 == []