Skip to main content

MultiValidate.assert_passing()

Raise an AssertionError if any step of any run failed.

Usage

Source

MultiValidate.assert_passing()

This is Validate.assert_passing() for all runs at once: if any run doesn’t pass (see all_passed()), an AssertionError lists the failing steps, grouped by run. Use it to fail a CI job or a test with one call after collecting the results.

Returns

None

Raises

AssertionError
If a step of any run failed.

Examples

The second of these runs has a failing step:

import pointblank as pb
import polars as pl

multi = pb.MultiValidate(
    *[
        pb.Validate(data=pl.DataFrame({"a": a}), tbl_name=name)
        .col_vals_gt(columns="a", value=0)
        .interrogate()
        for a, name in (([1, 2], "orders"), ([3, -4], "customers"))
    ]
)

try:
    multi.assert_passing()
except AssertionError as e:
    print(e)
The following assertions failed:
Run 2 (customers):
  - Step 1: Expect that values in `a` should be > `0`.

The message names each failing run, by its number and table name, with the steps that failed in it.