"""Strict test evidence used by repository recipes and their exported verifiers.""" from __future__ import annotations from dataclasses import dataclass from xml.etree import ElementTree @dataclass(frozen=True) class TestResults: __test__ = False statuses: dict[str, str] returncode: int @property def passed(self) -> set[str]: return {name for name, status in self.statuses.items() if status == "passed"} def parse_junit(text: str, *, returncode: int) -> TestResults: if " dict[str, list[str]]: if healthy.returncode != 0 or not healthy.passed: raise ValueError("Reference must execute successfully with passing tests") if healthy.statuses.keys() != defective.statuses.keys(): raise ValueError("Mutation changed test collection; contrast is not comparable") failing = sorted( name for name in healthy.passed if defective.statuses[name] in {"failed", "error"} ) if not failing or defective.returncode != 1: raise ValueError("No intended fail-to-pass contrast") return {"FAIL_TO_PASS": failing, "PASS_TO_PASS": sorted(healthy.passed - set(failing))}