"""Tests distillation preparation helpers.""" from __future__ import annotations import json from pathlib import Path from maris_core.training.distill import distill def test_distill_writes_plan_and_readme(tmp_path: Path) -> None: teacher_dir = tmp_path / "teacher" student_dir = tmp_path / "student" teacher_dir.mkdir() student_dir.mkdir() (teacher_dir / "config.json").write_text("{}", encoding="utf-8") output_dir = tmp_path / "distilled" distill(str(teacher_dir), str(student_dir), str(output_dir)) manifest = json.loads((output_dir / "distillation-plan.json").read_text(encoding="utf-8")) assert manifest["status"] == "prepared" assert manifest["teacher"]["is_local_path"] is True assert manifest["teacher"]["config_exists"] is True assert manifest["student"]["config_exists"] is False assert (output_dir / "README.md").is_file() def test_distill_rejects_empty_teacher_model(tmp_path: Path) -> None: try: distill(" ", "student", str(tmp_path / "distilled")) except ValueError as exc: assert "teacher_model" in str(exc) else: raise AssertionError("distill() should reject an empty teacher model reference")