def test_stats_run(project_path: Path) -> None:
        """Test execution of statistics calc. job."""
        mock_preds = [
            {
                "image": torch.rand(5, 3, 50, 50),
                "pred_score": torch.rand(4),
                "gt_label": torch.ones(4, dtype=torch.int32),
                "anomaly_map": torch.rand(4, 1, 50, 50),
                "gt_mask": torch.ones(4, 1, 50, 50, dtype=torch.int32),
            },
        ]
        data = [ImageBatch(**values) for values in mock_preds]

        stats_job_generator = StatisticsJobGenerator(project_path)
        stats_job = next(stats_job_generator.generate_jobs(None, data))

        results = stats_job.run()

        assert "minmax" in results
        assert "image_threshold" in results
        assert "pixel_threshold" in results

        # save as it's removed from results
        save_path = results["save_path"]
        stats_job.save(results)
        assert Path(save_path).exists()
Test execution of statistics calc. job.
tests/unit/pipelines/tiled_ensemble/test_components.py