Generate a new Zippy test. Args: scenario: The Scenario to pick actions from. actions: The number of actions to generate.
(
self, scenario: "Scenario", actions: int, max_execution_time: timedelta
)
| 179 | """A Zippy test, consisting of a sequence of actions.""" |
| 180 | |
| 181 | def __init__( |
| 182 | self, scenario: "Scenario", actions: int, max_execution_time: timedelta |
| 183 | ) -> None: |
| 184 | """Generate a new Zippy test. |
| 185 | |
| 186 | Args: |
| 187 | scenario: The Scenario to pick actions from. |
| 188 | actions: The number of actions to generate. |
| 189 | """ |
| 190 | self._scenario = scenario |
| 191 | self._actions: list[Action] = [] |
| 192 | self._final_actions: list[Action] = [] |
| 193 | self._capabilities = Capabilities() |
| 194 | self._actions_with_weight: dict[ActionOrFactory, float] = ( |
| 195 | self._scenario.actions_with_weight() |
| 196 | ) |
| 197 | self._state = State() |
| 198 | self._max_execution_time: timedelta = max_execution_time |
| 199 | |
| 200 | for action_or_factory in self._scenario.bootstrap(): |
| 201 | self._actions.extend(self.generate_actions(action_or_factory)) |
| 202 | |
| 203 | while len(self._actions) < actions: |
| 204 | action_or_factory = self._pick_action_or_factory() |
| 205 | self._actions.extend(self.generate_actions(action_or_factory)) |
| 206 | |
| 207 | def generate_actions(self, action_def: ActionOrFactory) -> list[Action]: |
| 208 | if isinstance(action_def, ActionFactory): |
nothing calls this directly
no test coverage detected