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")
- 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.
- 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.