is_step

typhoon.test.signals.is_step(signal, from_value, to_value, at_t, during=None, strictness=1, find_start=True, report_plot=None)

Checks if signal is a step with specified characteristics.

Verifies if signal starts at a starting value (from_value), then leaves it towards a final value (to_value). The transition should take place during the time specified by the time range at_t.

Parameters:
  • signal (pandas.Series) – Signal to be tested for.

  • from_value (2-element tuple/list or value) – Band inside which signal should be initially. Can be passed as a tuple/list with two elements for a range, or as a single value for an exact value.

  • to_value (2-element tuple/list or value) – Band signal should reach. Can be passed as a tuple/list with two elements for a range, or as a single value for an exact value.

  • at_t (2-element tuple/list of float or Timedelta) – Time during which signal should step from one range to the other. Range defined as a 2-element tuple with numbers or timedeltas.

  • during (2-element tuple of numbers or Timedelta) – Time period (as a range, 2-element tuple) to be considered for analysis.

  • find_start (bool) – If used, signal is analyzed from the moment when it reaches ‘from_value’. Otherwise signal is analyzed from beginning.

  • report_plot (dict) –

    Dictionary which overrides default allure report plot attachment behaviour. It also overrides behaviour specified for whole test run with command line arguments --analysis-plot-type and --analysis-plot-on-fail-only. Dictionary has two keys to be specified:

    1. type: specifies which kind of allure plot should be used. Valid values:

      • static - only matplotlib plot attached as .png picture is attached

      • interactive - only interactive html plot created with bokeh library is attached. Advantage of this plot it has options to zoom in/zoom out. Disadvantage is that it consumes significantly more memory.

      • none - none of the plots will be attached

      • all - all plots will be added. Currently supported ones are matplotlib plot(static) and bokeh plot(interactive)

    2. when: specifies when to add plots that are specified with previous key to report. Available options:

      • always - always adds specified plots

      • on-fail - adds plots only if comparison of reference and measured signal fails. This is good way to decrease size of allure plots.

    Note

    If report_plot argument is not provided, and command line arguments --analysis-plot-type and analysis-plot-on-fail-only are not specified, default behaviour is static plot, attached always. If command line arguments are specified, they define new default behaviour for whole test run.

Returns:

result – Result of the analysis.

Return type:

AnalysisResult

Examples

A step should happen at around 9 seconds

>>> result = is_step(capture["enable"], from_value=1, to_value=0, at_t=around(9,tol=1))
>>> assert result == True, result.msg

A more concise method is to use the assertion helper functions:

>>> assert_is_step(capture["enable"], from_value=1, to_value=0, at_t=around(9,tol=1))

See also

typhoon.test.signals.AnalysisResult, typhoon.test.signals.assert_is_step