Feedback Makers

Implements the feedback makers, which define how the feedback is provided to the user in case no overrides are set.

class ExpectFeedbackMaker

Factory class used to generate feedback based on user input data and the defaults provided when configuring an implementaion of the Asserter.

Configuration

Methods

get_feedback_maker

Generates a primed function that takes a potential user feedback override, and the type of feedback to be produced.

defaults: DefaultExpectFeedback
get_feedback_maker(inp)

Generates a primed function that takes a potential user feedback override, and the type of feedback to be produced.

If the custom feedback is None, the default[typ] is used instead. The generated piece of feedback is guaranteed to not be None.

Parameters:

inp (ExpectFeedbackMakerInput) – The input data for the feedback maker function.

Returns:

A function that produces a piece of feedback.

Return type:

Callable[[str | NoFeedback | None, FeedbackType], str | NoFeedback]

class ExistFeedbackMaker

Factory class used to generate feedback based on user input data and the defaults provided when configuring an implementation of the Asserter.

Configuration

Methods

get_feedback_maker

Generates a primed function that takes a potential user feedback override, and the type of feedback to be produced.

defaults: DefaultExistFeedback
get_feedback_maker(inp)

Generates a primed function that takes a potential user feedback override, and the type of feedback to be produced.

If the custom feedback is None, the default[typ] is used instead. The generated piece of feedback is guaranteed to not be None.

Parameters:

inp (ExistFeedbackMakerInput) – The input data for the feedback maker function.

Returns:

A function that produces a piece of feedback.

Return type:

Callable[[str | NoFeedback | None, FeedbackType], str | NoFeedback]

class DefaultExpectFeedback

Default feedback maker functions for ExpectFeedbackMaker.

Feedback Makers

positive

Maker function for positive feedback.

negative

Maker function for negative feedback.

positive: Callable[[ExpectFeedbackMakerInput], Union[str, NoFeedback]]

Maker function for positive feedback.

negative: Callable[[ExpectFeedbackMakerInput], Union[str, NoFeedback]]

Maker function for negative feedback.

class DefaultExistFeedback

Default feedback maker functions for ExistFeedbackMaker.

Feedback Makers

positive

Maker function for positive feedback.

negative

Maker function for negative feedback.

positive: Callable[[ExistFeedbackMakerInput], Union[str, NoFeedback]]

Maker function for positive feedback.

negative: Callable[[ExistFeedbackMakerInput], Union[str, NoFeedback]]

Maker function for negative feedback.

class ExpectFeedbackMakerInput

Provides the parameters for ExpectFeedbackMaker instances. Defines the contents of the feedback provided to the user.

Fields

what

What is the feedback about.

value

The value that was received.

expected

The representation of the expected value.

what: str

What is the feedback about. Should be just a name.

value: TypeVar(_Y)

The value that was received.

expected: Union[TypeVar(_Y), str]

The representation of the expected value.

class ExistFeedbackMakerInput

Provides the parameters for ExistFeedbackMaker instances. Defines the contents of the feedback provided to the user.

Fields

what

What is the feedback about.

expected

The representation of the expected value.

what: str

What is the feedback about. Should be just a name.

expected: Union[TypeVar(_Y), str]

The representation of the expected value.

PrimedFeedbackMakerF

A function that has been primed with configuration data and can be used to produce feedback pieces from the user override.

alias of Callable[[str | NoFeedback | None, FeedbackType], str | NoFeedback]

ExpectFeedbackMakerF

A function that takes a ExpectFeedbackMakerInput instance and produces a valid piece of feedback.

alias of Callable[[ExpectFeedbackMakerInput], str | NoFeedback]

ExistFeedbackMakerF

A function that takes a ExistFeedbackMakerInput instance and produces a valid piece of feedback.

alias of Callable[[ExistFeedbackMakerInput], str | NoFeedback]