1 """Benchmark validation matrices for partitioned runtime evidence bundles.""" 3 from pathlib
import Path
6 REPO_ROOT = Path(__file__).resolve().parents[3]
7 if str(REPO_ROOT)
not in sys.path:
8 sys.path.insert(0, str(REPO_ROOT))
10 from benchmarks.density_matrix.partitioned_runtime.runtime_audit_validation
import (
11 build_cases
as build_runtime_audit_cases,
13 from benchmarks.density_matrix.partitioned_runtime.runtime_handoff_validation
import (
14 build_cases
as build_runtime_handoff_cases,
16 from benchmarks.density_matrix.partitioned_runtime.runtime_output_validation
import (
17 build_cases
as build_runtime_output_cases,
19 from benchmarks.density_matrix.partitioned_runtime.unsupported_runtime_validation
import (
20 build_cases
as build_unsupported_runtime_cases,
22 from squander.partitioning.noisy_runtime
import (
23 PHASE3_RUNTIME_PATH_BASELINE,
28 cases = build_runtime_handoff_cases()
29 top_level_keys = {frozenset(case.keys())
for case
in cases}
30 summary_key_sets = {frozenset(case[
"summary"].
keys())
for case
in cases}
31 partition_key_sets = {
32 frozenset(case[
"partitions"][0].
keys())
for case
in cases
if case[
"partitions"]
35 assert len(cases) == 3
36 assert len(top_level_keys) == 1
37 assert len(summary_key_sets) == 1
38 assert len(partition_key_sets) == 1
42 cases = build_runtime_output_cases()
43 exact_output_key_sets = {frozenset(case[
"exact_output"].
keys())
for case
in cases}
45 assert len(cases) == 3
46 assert len(exact_output_key_sets) == 1
48 assert case[
"result_output_pass"]
is True 49 assert case[
"exact_output_present"]
is True 50 assert "shape" in case[
"exact_output"]
51 assert "trace_real" in case[
"exact_output"]
52 assert "density_real" in case[
"exact_output"]
53 assert "density_imag" in case[
"exact_output"]
57 cases = build_runtime_audit_cases()
58 top_level_keys = {frozenset(case.keys())
for case
in cases}
59 summary_key_sets = {frozenset(case[
"summary"].
keys())
for case
in cases}
60 partition_key_sets = {
61 frozenset(case[
"partitions"][0].
keys())
for case
in cases
if case[
"partitions"]
64 assert len(cases) == 3
65 assert len(top_level_keys) == 1
66 assert len(summary_key_sets) == 1
67 assert len(partition_key_sets) == 1
68 assert {case[
"runtime_path"]
for case
in cases} == {PHASE3_RUNTIME_PATH_BASELINE}
69 assert {case[
"requested_runtime_path"]
for case
in cases} == {PHASE3_RUNTIME_PATH_BASELINE}
73 cases = build_unsupported_runtime_cases()
74 expected_categories = {
75 "wrong_requested_mode":
"runtime_request",
76 "parameter_count_mismatch":
"runtime_request",
77 "unsupported_gate_name":
"unsupported_runtime_operation",
78 "unsupported_noise_name":
"unsupported_runtime_operation",
79 "gate_fixed_value":
"descriptor_to_runtime_mismatch",
82 assert {case[
"case_name"]
for case
in cases} == set(expected_categories)
84 assert case[
"status"] ==
"unsupported" 85 assert case[
"unsupported_category"] == expected_categories[case[
"case_name"]]
86 assert case[
"supported_runtime_case_recorded"]
is False def test_phase3_partitioned_runtime_runtime_handoff_cases_share_shape()
def test_partitioned_runtime_output_cases_share_exact_output_shape()
def test_partitioned_runtime_unsupported_cases_have_expected_categories()
def test_phase3_partitioned_runtime_runtime_audit_cases_share_shape()