23 lines
666 B
Python
23 lines
666 B
Python
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
import pytest
|
||
|
|
|
||
|
|
pytest.importorskip("torch")
|
||
|
|
|
||
|
|
from gpu_batch01_v1_2_runner import DEFAULT_ATR_LIMITS, _atr_limits
|
||
|
|
|
||
|
|
|
||
|
|
def test_v1_2_uses_fixed_atr_defaults_covering_documented_drift():
|
||
|
|
assert _atr_limits(None) == DEFAULT_ATR_LIMITS
|
||
|
|
assert DEFAULT_ATR_LIMITS["max_absolute_error"] >= 1.4210854715202004e-14
|
||
|
|
|
||
|
|
|
||
|
|
@pytest.mark.parametrize("limits", [
|
||
|
|
{"max_absolute_error": -1.0, "mae": 0.0},
|
||
|
|
{"max_absolute_error": float("nan"), "mae": 0.0},
|
||
|
|
{"max_absolute_error": 0.0},
|
||
|
|
])
|
||
|
|
def test_v1_2_rejects_invalid_atr_limits(limits):
|
||
|
|
with pytest.raises(ValueError, match="finite, non-negative"):
|
||
|
|
_atr_limits(limits)
|