40 lines
1.3 KiB
Python
40 lines
1.3 KiB
Python
"""Tests for the evidence-selected GTL composition matrix."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from scripts import run_gtl_confirmation_matrix as matrix
|
|
|
|
|
|
def test_confirmation_matrix_is_pre_registered_and_well_formed():
|
|
assert len(matrix.GTL_CONFIRMATION_ARMS) == 13
|
|
assert matrix.GTL_CONFIRMATION_ARMS[0]["name"] == "control"
|
|
names = [arm["name"] for arm in matrix.GTL_CONFIRMATION_ARMS]
|
|
assert len(names) == len(set(names))
|
|
|
|
for arm in matrix.GTL_CONFIRMATION_ARMS:
|
|
config = matrix._config(arm)
|
|
assert config["mode"] in {"intersection", "union"}
|
|
if config["mode"] == "union":
|
|
assert len(config["confirmations"]) == 1
|
|
for confirmation in config["confirmations"]:
|
|
assert confirmation["name"] in {
|
|
"touch_0_25pct",
|
|
"strength_1000",
|
|
"merge_0_25pct",
|
|
"pivots_none",
|
|
}
|
|
|
|
|
|
def test_signature_uses_only_control_parity_fields():
|
|
arm = {
|
|
"candidates": 100,
|
|
"qualified": 10,
|
|
"qualified_net_avg_r": 0.2,
|
|
"qualified_net_avg_r_ex_top5": 0.05,
|
|
"full_book": {"sharpe": 2.0},
|
|
"holdout": {"train": {"sharpe": 1.0}},
|
|
"unrelated": "ignored",
|
|
}
|
|
assert "unrelated" not in matrix._signature(arm)
|
|
assert matrix._signature(arm)["full_book"] == {"sharpe": 2.0}
|