scenario.assertionhelpers module¶
Assertion helpers.
Functions, types and constants for the Assertions
class.
- unittest¶
unittest.TestCase
instance used to callunittest
assertion functions.
- safecontainer(obj)¶
Ensures working with a string or list-like object.
- Parameters:
obj – Input iterable object.
- Returns:
String or list-like object:
may be used as is, in order to check its emptiness,
may be applied
len()
on it,has a
count()
method,…
- errmsg(optional, standard, *args)¶
Formats an error message: the optional and/or the regular one.
- Parameters:
optional – Optional assertion message, if set.
standard – Standard assertion message.
args – Standard assertion message arguments.
- Returns:
Error message.
- ctxmsg(context, err, *args)¶
Builds an contextual assertion message.
- Parameters:
context – Context pattern, basically the methods name (e.g.:
"assertisinstance()"
).err – Detailed assertion message.
args – Detailed assertion message arguments
- Returns:
Assertion message.
- isnonemsg(context, what)¶
Builds an assertion message indicating that an element in unexpectedly
None
.- Parameters:
context – Context pattern, basically the methods name (e.g.:
"assertisinstance()"
).what – Name of the parameter, or element, unexpectedly
None
(e.g.:"obj"
for aobj
parameter).
- Returns:
Assertion message.
- evidence(evidence_enabled, regular, *args)¶
Tracks assertion data, depending on the current scenario configuration
- Parameters:
evidence_enabled – Proof message activation and/or specialization (see the dedicated note).
regular – Regular proof message.
args – Proof message arguments.
- getstepexecution(step_execution_specification)¶
Retrieves the (last)
StepExecution
instance corresponding to the given specification.- Parameters:
step_execution_specification – Step execution specification (see
assertionhelpers.StepExecutionSpecType
).- Returns:
Step execution corresponding to the given specification.
- Raise:
Exception when the step execution could not be found.