Calculation

class Calculation

Returned by

EXPECTATION_MODE_ALWAYS

Returns the constant used to specify the expectation mode ‘Fulfilled everywhere’.

Returns:

The constant

Return type:

str

EXPECTATION_MODE_DURATION

Returns the constant used to specify the expectation mode ‘Fulfilled for at least’.

Returns:

The constant

Return type:

str

EXPECTATION_MODE_ONCE

Returns the constant used to specify the expectation mode ‘Fulfilled at least once’.

Returns:

The constant

Return type:

str

AddTag(tag)

Add a specific tag to this step.

Parameters:
tag : str

The tag to be set

AppendTraceStep(traceStep)

Adds a trace step at the end of its children.

Parameters:
traceStep

Trace step to be added

Clone()

Call this method if you want to use API-objects in multiple contexts, e.g. if you want to insert a specific test step in multiple blocks.

Returns:

A copy of this object

Return type:

Calculation

DeactivateExpectation()

Deactivates the expectation so that the expression of the calculation will not be evaluated.

DeactivateFailedComment()

Deactivates the expectation for the failed comment so that the result will not be evaluated.

DeactivateSaveIn()

Deactivates the save in property, so the expression value will not be stored in a generic signal.

DeactivateSuccessComment()

Deactivates the expectation for the success comment so that the result will not be evaluated.

GetDescription()

Returns the description of the trace analysis element.

Returns:

The description

Return type:

str

GetExpectation()

Returns the expectation expression for the evaluation of the calculation, or None, if no expectation was defined.

Returns:

The expectation

Return type:

Expectation

GetExpectationMode()

Returns the expectation mode. Possible values are ‘always’, ‘once’, ‘duration’ or None, if no expectation was defined.

Returns:

The expectation mode

Return type:

str

GetExpectationModeOptions()

Returns the expectation mode options.

Returns:

The options object for expectation mode parameters, or None if no expectation is set

Return type:

ExpectationModeOptions

GetExpression()

Returns the expression of the calculation.

Returns:

The expression

Return type:

str

GetFailedComment()

Returns the failed comment of the step.

Returns:

The failed comment

Return type:

string

GetIndex()

Returns the zero based index in the parent.

Returns:

Zero based index

Return type:

int

GetLineNo()

Returns the trace steps line number within its trace analysis.

Returns:

Line number

Return type:

int

GetName()

Returns the name of the trace analysis element.

Returns:

The name

Return type:

str

GetReportConfig()

Returns the report config for this trace step.

Returns:

The report config object

Return type:

ReportConfig

GetResultNoEval()

Returns the verdict of a calculation that is never evaluated.

Returns:

The verdict of the calculation if never evaluated

Return type:

str

GetSaveInSignalName()

Returns the currently selected signal to save the expression value.

Returns:

The signal’s name or None if expression value is not saved to a signal by the calculation.

Return type:

str

GetSuccessComment()

Returns the success comment of the step.

Returns:

The success comment

Return type:

string

GetTags()

Returns the tags set for this step.

Returns:

A (sorted) list of tags

Return type:

list[str]

GetTraceSteps(skipDisabledSteps=False, recursive=False)

Returns either direct or all children of the trace step.

Parameters:
skipDisabledSteps : boolean

Defines whether disabled trace steps should be excluded, defaults to False.

recursive : boolean

Defines whether children of children are included, defaults to False.

Returns:

The trace steps as flat list.

Return type:

list[TraceStep]

GetType()

Returns the type (class name) of the trace step, e.g.

  • ‘Episode’

  • ‘AnalysisBlock’

  • ‘TriggerBlock’

  • ‘Calculation’

  • ‘TemplateBasedTraceStep’

  • ‘TraceAnalysisReference’

  • ‘TraceAnalysisReferenceDeprecated’

Returns:

Type (class name) of the trace step

Return type:

str

GetUuid()

Returns the UUID of the trace step.

Returns:

UUID of the trace step

Return type:

str

GetVectorExpectationMode()

Returns the vector expectation mode. Possible values are:

  • ‘no vector’

  • ‘all components’

  • ‘any component’

Returns:

The vector expectation mode

Return type:

str

InsertTraceStep(traceStep, position)

Adds a trace step at a certain line of the trace analysis.

Parameters:
traceStep

Trace step to be added

position : integer

Target index of child beginning with 0

IsContainer()

Checks whether this trace step can contain trace steps.

Returns:

True if it can contain trace steps, else False

Return type:

boolean

IsEnabled()

Checks whether the trace step is enabled.

Returns:

True if trace step is enabled, else False

Return type:

boolean

IsOk()

Returns the internal state of correctness of the trace step.

Returns:

True if no problems were found, else False

Return type:

boolean

IsVisible()

Checks whether the trace step is visible. This depends on the trace step itself or a parent trace step being disabled.

Returns:

True if trace step is visible, else False

Return type:

boolean

RemoveTag(tag)

Remove a specific tag from this step.

Parameters:
tag : str

The tag to be removed

RemoveTraceStep(traceStep)

Removes the given trace step from the trace analysis.

Parameters:
traceStep

Trace step to be removed

SetDescription(value)

Sets the description of the trace analysis element.

Parameters:
value : str

The new description

SetEnabled(enable)

Enables or disables the trace step (this also affects child trace steps).

Parameters:
enable : boolean

If True, enables the trace step, if False, disables the trace step

SetExpression(expression)

Sets the expression of the calculation.

Parameters:
expression : str

The expression

SetFailedComment(failedComment)

Sets the expression for the failed comment of the step. The expression will be activated if it was not enabled previously.

Parameters:
failedComment : string

The expression for the failed comment

SetName(value)

Sets the name of the trace analysis element.

Parameters:
value : str

The new name

SetResultNoEval(resultNoEval)

Sets the verdict of a calculation that is never evaluated. Possible values: ‘NONE’, ‘SUCCESS’, ‘INCONCLUSIVE’, ‘FAILED’ or ‘ERROR’.

Parameters:
resultNoEval : str

The verdict of the calculation if never evaluated

SetSaveInSignalName(signalName)

Sets the name of the generic signal used for storing the expression value.

Parameters:
signalName : str

The signal’s name. Must not be None or an empty string.

Raises:

ApiError – If signalName is None or an empty string

SetSuccessComment(successComment)

Sets the expression for the success comment of the step. The expression will be activated if it was not enabled previously.

Parameters:
successComment : string

The expression for the success comment

SetTags(tags)

Set the list of tags for this step. The list of tags will be sorted and stored.

Parameters:
tags : list[str]

The list of tags

SetVectorExpectationMode(vectorMode)

Sets the vector expectation mode. Possible values are:

  • ‘no vector’

  • ‘all components’

  • ‘any component’

Parameters:
vectorMode : str

The vector expectation mode

GetExpectationModeParam()

Returns the expectation mode parameter or None, if no expectation was defined. For mode ‘duration’ this is the minimal duration.

Returns:

The expectation mode parameter

Return type:

str

Deprecated since version 2024.3: Please use methods GetExpectationModeOptions().GetMinDuration instead.

SetExpectation(expectation, mode, modeParam=None)

Sets the expectation for the evaluation of the calculation. The expectation will be activated if it was not enabled previously. Possible values for mode can be obtained by either of the constants:

Use modeParam to specify the minimal duration (duration mode only).

Parameters:
expectation

The expectation

mode : str

The expression for expectation mode

modeParam : str

The expression for modeParam

Raises:

ValueError – If the expectation is not of type NumericExpectation or StringExpectation

Deprecated since version 2024.3: Argument modeParam must be set via GetExpectationModeOptions() instead.