test_compact_function_edges.py 813 B

1234567891011121314151617181920212223242526
  1. import pytest
  2. from agency_swarm.ui.demos.compact import compact_thread
  3. from agency_swarm.utils.thread import ThreadManager
  4. class _Agency:
  5. def __init__(self, entry_points):
  6. self.entry_points = entry_points
  7. self.thread_manager = ThreadManager()
  8. """Edge-case tests for compact_thread.
  9. This file intentionally avoids mocking the OpenAI client to non-Response
  10. types. In production, compact_thread receives an OpenAI Response object.
  11. """
  12. @pytest.mark.asyncio
  13. async def test_compact_thread_requires_entry_points(monkeypatch):
  14. # Avoid touching TerminalDemoLauncher; function raises early when no entry points
  15. agency = _Agency(entry_points=[])
  16. with pytest.raises(RuntimeError) as ei:
  17. await compact_thread(agency, [])
  18. assert "Agency has no entry points" in str(ei.value)