QuantumLearning/tests/test_assessment.py

108 lines
3 KiB
Python

from quantum_learning.assessment import (
evaluate_evidence_checklist,
evaluate_feedback_loop,
load_assessment_blueprint,
score_named_rubric,
)
from quantum_learning.config import project_root
def test_assessment_blueprint_loads_capstone_rubric():
blueprint = load_assessment_blueprint()
assert blueprint.title == "QuantumLearning Assessment Blueprint"
assert len(blueprint.rubrics) >= 2
assert blueprint.get_rubric("capstone_design_review").required_evidence
def test_module_self_review_rubric_distinguishes_strong_and_weak_work():
strong = score_named_rubric(
"module_self_review",
{
"claim": 4,
"evidence": 4,
"risk": 3,
"revision": 4,
},
)
weak = score_named_rubric(
"module_self_review",
{
"claim": 1,
"evidence": 1,
"risk": 0,
"revision": 1,
},
)
assert strong.passed
assert strong.band in {"competent", "mastery-ready"}
assert not weak.passed
assert weak.band == "revision-needed"
def test_feedback_loop_flags_missing_sections():
report = evaluate_feedback_loop(
{
"claim": "The compiled candidate is better on this topology.",
"evidence": "",
"risk": "The noise model is still local and synthetic.",
"next_step": "",
}
)
assert not report.ready_for_review
assert report.missing_sections == ("Evidence", "Next Step")
def test_evidence_checklist_requires_all_items():
report = evaluate_evidence_checklist(
["Brief", "Evidence", "Risk"],
{"Brief": True, "Evidence": False, "Risk": True},
)
assert not report.ready_for_review
assert report.missing_items == ("Evidence",)
def test_capstone_notebooks_reference_rubric_and_feedback_widgets():
capstone_dir = project_root() / "notebooks" / "professional" / "module_04_capstone_design_review"
lecture = (capstone_dir / "lecture.ipynb").read_text()
studio = (capstone_dir / "studio.ipynb").read_text()
assert "capstone_design_review" in studio
assert "feedback_iteration_panel(" in lecture
assert "evidence_checklist(" in studio
def test_capstone_rubric_maps_to_intended_competence_dimensions():
rubric = load_assessment_blueprint().get_rubric("capstone_design_review")
assert [criterion.identifier for criterion in rubric.criteria] == [
"brief",
"candidates",
"ideal",
"hardware",
"noise",
"recommendation",
"risk",
]
def test_capstone_rubric_rewards_complete_design_review_evidence():
result = score_named_rubric(
"capstone_design_review",
{
"brief": 4,
"candidates": 4,
"ideal": 4,
"hardware": 4,
"noise": 4,
"recommendation": 4,
"risk": 4,
},
)
assert result.total_score == 28
assert result.passed
assert result.band == "mastery-ready"