Actor API

class Actor(name: str)

Represents an Actor, holding their name and Abilities.

Actors are the performers of your screenplay. They represent your users as they go about their business using your product.

Examples:

Perry = Actor.named("Perry")
classmethod named(name: str) Self

Give a name to this Actor.

who_can(*abilities: T_Ability) Self

Add one or more Abilities to this Actor.

Aliases:
can(*abilities: T_Ability) Self

Alias for who_can().

has_ordered_cleanup_tasks(*tasks: Performable) Self

Assign one or more tasks for the Actor to perform when exiting.

The tasks given to this method must be performed successfully in order. If any task fails, any subsequent tasks will not be attempted and will be discarded.

Aliases:
with_ordered_cleanup_tasks(*tasks: Performable) Self

Alias for has_ordered_cleanup_tasks().

has_independent_cleanup_tasks(*tasks: Performable) Self

Assign one or more tasks for the Actor to perform when exiting.

The tasks included through this method are assumed to be independent; that is to say, all of them will be executed regardless of whether previous ones were successful.

Aliases:
with_independent_cleanup_tasks(*tasks: Performable) Self

Alias for has_independent_cleanup_tasks().

uses_ability_to(ability: type[T_Ability]) T_Ability

Find the Ability referenced and return it, if the Actor is capable.

Raises:

UnableToPerform: the Actor doesn’t possess the Ability.

Aliases:
ability_to(ability: type[T_Ability]) T_Ability

Alias for uses_ability_to().

has_ability_to(ability: type[T_Ability]) bool

Ask whether the Actor has the Ability to do something.

attempts_to(*actions: Performable) None

Perform a list of Actions, one after the other.

Aliases:
was_able_to(*actions: Performable) None

Alias for attempts_to().

tries_to(*actions: Performable) None

Alias for attempts_to().

tried_to(*actions: Performable) None

Alias for attempts_to().

tries(*actions: Performable) None

Alias for attempts_to().

tried(*actions: Performable) None

Alias for attempts_to().

does(*actions: Performable) None

Alias for attempts_to().

did(*actions: Performable) None

Alias for attempts_to().

will(*actions: Performable) None

Alias for attempts_to().

shall(*actions: Performable) None

Alias for attempts_to().

should(*actions: Performable) None

Alias for attempts_to().

perform(action: Performable) None

Perform an Action.

cleans_up_ordered_tasks() None

Perform ordered clean-up tasks.

cleans_up_independent_tasks() None

Perform independent clean-up tasks.

cleans_up() None

Perform any scheduled clean-up tasks.

exit() None

Direct the Actor to forget all their Abilities.

Aliases:
exit_stage_left() None

Alias for exit().

exit_stage_right() None

Alias for exit().

exit_through_vomitorium() None

Alias for exit().