feat(assessment): grade choice answers with distractors from error models

This commit is contained in:
shira committed 2026-10-11 03:12:24 +03:00
1 parent efa41d5967
commit f1147b1885
22 files changed
+1346 -47

No files matched your search

@@ -165,3 +165,27 @@ func TestParseAssessmentReviewActorRequiresAnOperatorHandle(t *testing.T) {
}
}
}
// A choice among a few options has an answer space as small as an integer, so
// the signals observe it in that class; a stored observation can hold only the
// two classes it was created with.
func TestSignalAnswerFormatObservesAChoiceLikeAnInteger(t *testing.T) {
for variantFormat, want := range map[string]string{
AnswerFormatChoice: AnswerFormatInteger,
AnswerFormatInteger: AnswerFormatInteger,
AnswerFormatIntegerSequence: AnswerFormatIntegerSequence,
} {
got := SignalAnswerFormat(variantFormat)
if got != want {
t.Errorf("SignalAnswerFormat(%q) = %q, want %q", variantFormat, got, want)
}
observation := AssessmentAnswerObservation{
AttemptID: AssessmentAttemptID(uuid.New()), UserID: uuid.New(), ItemInstanceID: uuid.New(),
FamilyID: AssessmentFamilyID(uuid.New()), FamilyVersion: 1, AnswerFormat: got,
Fingerprint: AssessmentDigest{1}, KeyVersion: 1, ObservedAt: time.Now(),
}
if err := observation.Validate(); err != nil {
t.Errorf("Validate() for variant format %q error = %v", variantFormat, err)
}
}
}