import pytest from community_qa_bot.text import split_text class TestSplitText: @pytest.mark.parametrize("text, max_chars_per_segment, expected", [ ("hello world", 5, ["hello", "world"]), ("hello\nworld", 6, ["hello", "world"]), ("hello\nworld", 8, ["hello", "world"]), ("hello world", 10, ["hello", "world"]), ("hello world", 11, ["hello world"]), ("hello world\nhello world", 11, ["hello world", "hello world"]), ("hello world\nthis is a test", 11, ["hello world", "this is a", "test"]), ]) def test_split_text(self, text, max_chars_per_segment, expected): assert split_text(text, max_chars_per_segment) == expected