Skip to content

Any test payload, the answer as a test, Greek aliases, and a multiple choice check - #96

Merged
peterbjohnson merged 3 commits into
mainfrom
response-area-helpers
Nov 8, 2026
Merged

peterbjohnson merged 3 commits into
mainfrom
response-area-helpers

Conversation

@peterbjohnson

Copy link
Copy Markdown
Member
  • Test payloads of any type. Test.payload was typed str, so beartype rejected numbers. NUMBER tests in real exports store JSON numbers (see fixtures/exports/introduction_to_lambda_feedback/question_000_Numeric_Questions.json). Test(2.5, True) now exports "payload": 2.5.
  • The answer is always tested. Each response area's answer is written first as a passing test, unless a passing test already has that payload. An answer of None or "" adds no test. An empty list counts as no answer, so it is written as a failing test.
  • InputSymbol.greek(symbol, code, extra=()). It builds aliases from the unicode forms of a Greek letter name, with and without braces around a subscript. No alias joins the base and the subscript without _, because sigmaf could be read as two symbols. An unknown name raises ValueError.
  • Multiple choice check. Before export, a set with a multiple choice that marks no option correct raises ValueError, naming the question and part. The check runs before main clears the output directory, so an earlier export survives.

🤖 Generated with Claude Code

peterbjohnson and others added 3 commits November 8, 2026 05:15
- Test.payload takes any type, as NUMBER tests in real exports store
  numbers.
- Each response area's answer is written as a passing test, first,
  unless the answer is empty or a passing test already has it.
- InputSymbol.greek builds the aliases of a Greek symbol from its
  unicode forms, with and without braces around a subscript.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- An empty-list answer is no answer, so it is written as a failing test.
- A set with a multiple choice that marks no option correct raises
  ValueError before export, ahead of the output directory being
  cleared, naming the question and part.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The converter called a MultipleChoice-specific check and so had to import
that type. Each ResponseArea now declares payload_types, the types a test
payload may take, and a _validate method that subclasses extend; the
converter calls _validate on every area without naming any type. Number
refuses bool payloads, and MultipleChoice refuses an answer or test whose
length differs from its options. An empty answer now adds no test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JnCY3kcqP1vQ7UixMtuRep
@peterbjohnson

Copy link
Copy Markdown
Member Author

Note the PR was updated to generalise the response types for all RAs, not just MCQ. Following that it was judged acceptable.

@peterbjohnson
peterbjohnson merged commit 621b019 into main Nov 8, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants