Spaces:
Sleeping
Sleeping
Download tests/test_memory_compaction.py from baljot07/studiq-backend: direct link, hf CLI and curl.
- Browser
- Download file 549 Bytes
-
https://huggingface.co/spaces/baljot07/studiq-backend/resolve/main/tests/test_memory_compaction.py
- Command line
-
hf download hf://spaces/baljot07/studiq-backend/tests/test_memory_compaction.py
-
curl -L -o test_memory_compaction.py https://huggingface.co/spaces/baljot07/studiq-backend/resolve/main/tests/test_memory_compaction.py
549 Bytes
| """Unit tests for conversation turn grouping in daily memory compaction.""" | |
| import pytest | |
| def test_message_grouping_by_user(): | |
| """Verify grouping raw messages by user ID for batch compaction.""" | |
| messages = [ | |
| {"user_id": "u1", "content": "Topic 1"}, | |
| {"user_id": "u2", "content": "Topic 2"}, | |
| {"user_id": "u1", "content": "Topic 3"}, | |
| ] | |
| grouped = {} | |
| for m in messages: | |
| grouped.setdefault(m["user_id"], []).append(m["content"]) | |
| assert len(grouped["u1"]) == 2 | |
| assert len(grouped["u2"]) == 1 | |