assertion message

Your own text added after an assert, following a comma, that pytest prints when the assertion fails.

In more detail

Use it for context the values cannot supply, such as which record in a batch failed. Do not restate the assertion, because pytest already prints the values, and a message that disagrees with the code misleads.

Example

assert total == expected, f"batch row {i} in {currency}"

Related terms

Taught in

References