def mock_datapoint(path: str,
initial_value: Any,
behaviors: List[Behavior] = None)
Mock a single datapoint.
Arguments:
path
str - The VSS path of the datapoint to mock.initial_value
Any - The initial value the datapoint will assume on registration.behaviors
List[Behavior] - A list of programmed behaviors to execute for the mocked datapoint.
def create_behavior(
trigger: Trigger,
action: Action,
condition: Callable[[ExecutionContext],
bool] = lambda _: True) -> Behavior
Create a behavior from the given parameters. It is mandatory to call this when using Python DSL in order to derive required datapoints.
Arguments:
trigger
Trigger - A trigger which will invoke this behavior. Can either beClockTrigger
orEventTrigger
.action
Action, optional - An action to execute once the trigger activates and the condition evaluates to true. Defaults to None.condition
type, optional - A condition which needs to be fulfilled AFTER the trigger has activated in order to execute the action. Defaults to lambda_:True.
Returns:
Behavior
- A new behavior with the given trigger, condition and action.
def add_behavior(behavior: Behavior, path: str)
Add a given behavior to an already mocked datapoint
Arguments:
behavior
Behavior - The behavior that shall be addedpath
str - The already mocked datapoint to whom shall be added
def get_datapoint_value(context: ExecutionContext,
path: str,
default: Any = 0) -> Any
Get the value of a datapoint or, if its not available yet, a default value is returned.
Arguments:
context
ExecutionContext - The execution context from which the datapoint can be retrieved.path
str - The path of the VSS datapoint.default
Any, optional - Optional default value if there is no value for the datapoint. Defaults to 0.
Returns:
Any
- The value of the datapoint at the specified path or the provided default value.
def create_set_action(value: Any) -> SetAction
Create a SetAction with dynamic value resolution. See __resolve_value
for documentation of value resolution.
Arguments:
value
Any - The value to set or a dynamic literal.
Returns:
SetAction
- The created SetAction.
def create_animation_action(
values: List[Any],
duration: float,
repeat_mode: RepeatMode = RepeatMode.ONCE) -> AnimationAction
Create an AnimationAction with dynamic value resolution.
Values are dynamically resolved at trigger activation time of the owning behavior.
See __resolve_value
for documentation of value resolution.
Arguments:
values
List[Any] - The list of values to animate over. May contain dynamic values.duration
float - The total duration of the animation in seconds.repeat_mode
RepeatMode, optional - The repeat mode of the animation. Defaults to RepeatMode.ONCE.
Returns:
AnimationAction
- The created AnimationAction.
def create_event_trigger(type: EventType,
path: Optional[str] = None) -> EventTrigger
Create an EventTrigger for the mocked datapoint in context of this call OR the explicitly passed one.
Arguments:
type
EventType - The type of event which will activate the trigger.path
Optional[str] - The data point which shall raise the event. If not set defaults to the mocked data point in context of the call.
Returns:
EvenTrigger
- The created EventTrigger.
def delete_behavior_of_mocked_datapoint(behavior: Behavior, path: str)
Delete one behavior for a mocked datapoint
Arguments:
behavior
Behavior - The behavior which shall be removed.path
str - The data point which behavior shall be removed.
def delete_mocked_datapoint(path: str)
Delete all behaviors for a mocked datapoint
Arguments:
path
str - The path for which all behaviors shall be removed.
def delete_all_mocked_datapoints()
Delete all mocked datapoints from the mock