STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
test_api_nonfinite_serialization Namespace Reference

Functions

 test_non_finite_becomes_none (convert, bad)
 test_nested_payload_is_json_serialisable (convert)
 test_finite_values_are_untouched (convert)

Variables

list CONVERTERS

Detailed Description

Non-finite floats must not take down an API response.

A NaN anywhere in the results dict made json.dumps raise
"Out of range float values are not JSON compliant", which the evaluate router
turned into a blanket HTTP 500 on forward evaluation. NaN is a legal model output
(e.g. a lag model that does not define K_v), so it must serialise as null.

Function Documentation

◆ test_finite_values_are_untouched()

test_api_nonfinite_serialization.test_finite_values_are_untouched ( convert)
The guard must not eat real numbers.

Definition at line 52 of file test_api_nonfinite_serialization.py.

References convert().

◆ test_nested_payload_is_json_serialisable()

test_api_nonfinite_serialization.test_nested_payload_is_json_serialisable ( convert)
The shape that actually broke: NaN buried in the stability payload.

Definition at line 33 of file test_api_nonfinite_serialization.py.

References convert().

◆ test_non_finite_becomes_none()

test_api_nonfinite_serialization.test_non_finite_becomes_none ( convert,
bad )

Definition at line 28 of file test_api_nonfinite_serialization.py.

References convert().

Variable Documentation

◆ CONVERTERS

list test_api_nonfinite_serialization.CONVERTERS
Initial value:
1= [
2 pytest.param(ev_convert, id="evaluate"),
3 pytest.param(fl_convert, id="flight"),
4 pytest.param(ts_convert, id="timeseries"),
5 pytest.param(op_convert, id="optimizer"),
6]

Definition at line 17 of file test_api_nonfinite_serialization.py.