62 lines
2.4 KiB
Python
62 lines
2.4 KiB
Python
from __future__ import annotations
|
|
|
|
import json
|
|
|
|
from control_plane.trading_studio.indicators.batch01_native_parity import (
|
|
batch01_native_parity_manifest,
|
|
batch01_native_parity_manifest_bytes,
|
|
evaluate_batch01_native_parity,
|
|
)
|
|
|
|
|
|
def test_batch01_native_parity_manifest_pins_local_oracle_inputs():
|
|
manifest = batch01_native_parity_manifest()
|
|
assert manifest["variant_count"] == 97
|
|
assert manifest["comparison"] == {
|
|
"dtype": "exact", "shape": "exact", "nan_mask": "exact", "values": "exact"
|
|
}
|
|
assert manifest["derived_state_transitions"]["indicator_ids"] == [19, 28]
|
|
assert manifest["documented_exception"]["global_tolerance"] == "forbidden"
|
|
assert json.loads(batch01_native_parity_manifest_bytes()) == manifest
|
|
|
|
|
|
def test_all_97_batch01_native_outputs_match_with_only_documented_bollinger_ulp_cases():
|
|
report = evaluate_batch01_native_parity()
|
|
state_records = [
|
|
item
|
|
for item in report["records"]
|
|
if item["name"].endswith((":state", ":transitions"))
|
|
]
|
|
assert len(state_records) == 30
|
|
assert all(item["status"] == "pass" for item in state_records)
|
|
accepted = [
|
|
item
|
|
for item in report["records"]
|
|
if item["reason"] == "accepted_documented_float64_ulp_drift"
|
|
]
|
|
assert {item["name"] for item in accepted} == {
|
|
"batch01_17_14_2",
|
|
"batch01_17_18_2",
|
|
"batch01_17_20_1.5",
|
|
"batch01_18_14_2",
|
|
"batch01_18_18_2",
|
|
"batch01_18_20_1.5",
|
|
}
|
|
assert sum(item["value_mismatches"] for item in accepted) == 8
|
|
assert report["acceptance_manifest"]["status"] == "accepted"
|
|
coverage = report["acceptance_manifest"]["coverage"]
|
|
assert coverage["submitted_feature_versions"] == 97
|
|
assert coverage["passed_feature_versions"] == 97
|
|
assert coverage["submitted_usage_slots"] == 97
|
|
assert coverage["passed_usage_slots"] == 97
|
|
assert coverage["coverage_percent"] == 100.0
|
|
assert len(coverage["feature_versions"]) == 97
|
|
failures = report["failures"]
|
|
assert not failures, "\n".join(
|
|
f"{item['name']}: {item['reason']} "
|
|
f"(dtype {item['expected_dtype']} != {item['actual_dtype']}, "
|
|
f"shape {item['expected_shape']} != {item['actual_shape']}, "
|
|
f"NaN mismatches={item['nan_mask_mismatches']}, "
|
|
f"value mismatches={item['value_mismatches']})"
|
|
for item in failures
|
|
)
|