in2lambda.api.response_area.ResponseArea¶

class in2lambda.api.response_area.ResponseArea(*, answer: Any = None, evaluation_function: str = <default>, grade_params: dict[str, ~typing.Any] | None=None, pre_text: str = '', post_text: str = '', content_after: str = '', check_button_text: str = '', input_symbols: list[InputSymbol] = <factory>, display_input_symbols: bool = <default>, live_preview: bool = <default>, include_in_pdf: bool = <default>, save_allowed: bool = <default>, separate_feedback: bool = <default>, common_feedback_color: str = <default>, correct_feedback_color: str = <default>, correct_feedback_prefix: str = <default>, incorrect_feedback_color: str = <default>, incorrect_feedback_prefix: str = <default>, tests: list[Test] = <factory>, accept: list[Any] = <factory>, reject: list[Any] = <factory>, cases: list[Case] = <factory>)[source]¶

Bases: object

Specifies the interaction when a student provides a response.

Multiple response areas per part are allowed; if so, order is implicit. Use a subclass for each response type. grade_params are passed to the evaluation function unedited.

Examples

>>> from in2lambda.api.response_area import NumericUnits, Test
>>> area = NumericUnits(
...     answer="30 N",
...     grade_params={"rtol": 0.05},
...     pre_text="$F=$",
...     tests=[Test("30 N", True)],
... )
>>> area.response_type, area.evaluation_function
('NUMERIC_UNITS', 'compareExpressions')
__init__(*, answer: Any = None, evaluation_function: str = <default>, grade_params: dict[str, ~typing.Any] | None=None, pre_text: str = '', post_text: str = '', content_after: str = '', check_button_text: str = '', input_symbols: list[InputSymbol] = <factory>, display_input_symbols: bool = <default>, live_preview: bool = <default>, include_in_pdf: bool = <default>, save_allowed: bool = <default>, separate_feedback: bool = <default>, common_feedback_color: str = <default>, correct_feedback_color: str = <default>, correct_feedback_prefix: str = <default>, incorrect_feedback_color: str = <default>, incorrect_feedback_prefix: str = <default>, tests: list[Test] = <factory>, accept: list[Any] = <factory>, reject: list[Any] = <factory>, cases: list[Case] = <factory>) → None¶

Methods

__init__(*, answer, evaluation_function, ...)

Attributes

answer

check_button_text

Replaces the label of the check button; left out of the JSON when empty.

common_feedback_color

content_after

Markdown shown after the box, before the next one.

correct_feedback_color

correct_feedback_prefix

display_input_symbols

evaluation_function

grade_params

include_in_pdf

incorrect_feedback_color

incorrect_feedback_prefix

live_preview

payload_types

The types a test payload, a sample response, may take.

post_text

pre_text

save_allowed

separate_feedback

response_type

input_symbols

tests

accept

Responses that must be marked correct; each is written as a passing test.

reject

Responses that must be marked incorrect; each is written as a failing test.

cases

accept: list[Any]¶

Responses that must be marked correct; each is written as a passing test.

check_button_text: str = ''¶

Replaces the label of the check button; left out of the JSON when empty.

content_after: str = ''¶

Markdown shown after the box, before the next one.

payload_types: ClassVar[tuple[type, ...]] = (<class 'object'>,)¶

The types a test payload, a sample response, may take.

reject: list[Any]¶

Responses that must be marked incorrect; each is written as a failing test.