test_smoke_model.py 862 B

1234567891011121314151617181920212223242526272829303132
  1. from __future__ import annotations
  2. import runpy
  3. from pathlib import Path
  4. import pytest
  5. ROOT = Path(__file__).resolve().parents[3]
  6. SMOKE = runpy.run_path(ROOT / "scripts" / "smoke-python-runtime.py")
  7. @pytest.mark.parametrize(
  8. ("prompt_name", "expected"),
  9. [
  10. ("SNAPSHOT_DIRECT_CHILD_PROMPT", "DIRECT_CHILD_OK"),
  11. ("SNAPSHOT_WORKFLOW_CHILD_PROMPT", "WORKFLOW_CHILD_OK"),
  12. ],
  13. )
  14. def test_child_prompt_precedes_runtime_context(prompt_name: str, expected: str) -> None:
  15. chunks = SMOKE["completion_chunks"]({
  16. "messages": [
  17. {"role": "user", "content": SMOKE[prompt_name]},
  18. {"role": "user", "content": "Current runtime context"},
  19. ],
  20. })
  21. assert any(
  22. choice.get("delta", {}).get("content") == expected
  23. for chunk in chunks
  24. for choice in chunk.get("choices", [])
  25. )