Module testing

sismic.testing.state_is_entered(steps, name)

Holds if state was entered during given steps.

Parameters
  • steps (Union[MacroStep, List[MacroStep]]) – a macrostep or list of macrosteps

  • name (str) – name of a state

Return type

bool

Returns

given state was entered

sismic.testing.state_is_exited(steps, name)

Holds if state was exited during given steps.

Parameters
  • steps (Union[MacroStep, List[MacroStep]]) – a macrostep or list of macrosteps

  • name (str) – name of a state

Return type

bool

Returns

given state was exited

sismic.testing.event_is_fired(steps, name, parameters=None)

Holds if an event was fired during given steps.

If name is None, this function looks for any event. If parameters are provided, their values are compared with the respective attribute of the event. Not all parameters have to be provided, as only the ones that are provided are actually compared.

Parameters
  • steps (Union[MacroStep, List[MacroStep]]) – a macrostep or list of macrosteps

  • name (Optional[str]) – name of an event

  • parameters (Optional[Mapping[str, Any]]) – additional parameters

Return type

bool

Returns

event was fired

sismic.testing.event_is_consumed(steps, name, parameters=None)

Holds if an event was consumed during given steps.

If name is None, this function looks for any event. If parameters are provided, their values are compared with the respective attribute of the event. Not all parameters have to be provided, as only the ones that are provided are actually compared.

Parameters
  • steps (Union[MacroStep, List[MacroStep]]) – a macrostep or list of macrosteps

  • name (Optional[str]) – name of an event

  • parameters (Optional[Mapping[str, Any]]) – additional parameters

Return type

bool

Returns

event was consumed

sismic.testing.transition_is_processed(steps, transition=None)

Holds if a transition was processed during given steps.

If no transition is provided, this function looks for any transition.

Parameters
Return type

bool

Returns

transition was processed

sismic.testing.expression_holds(interpreter, expression)

Holds if given expression holds.

Parameters
  • interpreter (Interpreter) – current interpreter

  • expression (str) – expression to evaluate

Return type

bool

Returns

expression holds