def test_pimo(
    anomaly_maps: Tensor,
    masks: Tensor,
    expected_thresholds: Tensor,
    expected_shared_fpr: Tensor,
    expected_per_image_tprs: Tensor,
    expected_image_classes: Tensor,
) -> None:
    """Test if `pimo()` returns the expected values."""

    def do_assertions(pimo_result: PIMOResult) -> None:
        thresholds = pimo_result.thresholds
        shared_fpr = pimo_result.shared_fpr
        per_image_tprs = pimo_result.per_image_tprs
        image_classes = pimo_result.image_classes
        _do_test_pimo_outputs(
            thresholds,
            shared_fpr,
            per_image_tprs,
            image_classes,
            expected_thresholds,
            expected_shared_fpr,
            expected_per_image_tprs,
            expected_image_classes,
        )

    # metric interface
    metric = pimo._PIMO(  # noqa: SLF001
        num_thresholds=7,
    )
    metric.update(anomaly_maps, masks)
    pimo_result = metric.compute()
    do_assertions(pimo_result)
Test if `pimo()` returns the expected values.
tests/unit/metrics/pimo/test_pimo.py