ea64f3c524
Refs #118 #119 #121 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
31 lines
1.3 KiB
Python
31 lines
1.3 KiB
Python
"""#118: il riepilogo task mostra NaN per una quota non misurata (value None)."""
|
|
import pytest
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def _station(monkeypatch):
|
|
monkeypatch.setattr("blueprints.measure.Config.STATION_CODE", "ST-TEST")
|
|
|
|
|
|
def test_task_complete_renders_nan_for_null_value(logged_in_client, mock_api_client):
|
|
mock_api_client.get.side_effect = [
|
|
{"id": 1, "code": "REC-001", "name": "Test Recipe", "version": 1},
|
|
[{"id": 1, "title": "Task 1", "order_index": 0, "subtasks": [
|
|
{"id": 1, "marker_number": 1, "description": "quota mancante", "nominal": 1.0,
|
|
"unit": "mm"},
|
|
{"id": 2, "marker_number": 2, "description": "quota ok", "nominal": 2.0,
|
|
"unit": "mm"}]}],
|
|
None,
|
|
{"items": [
|
|
{"id": 1, "subtask_id": 1, "value": None, "deviation": None, "pass_fail": "fail",
|
|
"measured_at": "2026-10-06T08:00:00+00:00"},
|
|
{"id": 2, "subtask_id": 2, "value": 2.5, "pass_fail": "pass",
|
|
"measured_at": "2026-10-06T08:00:00+00:00"},
|
|
]},
|
|
]
|
|
resp = logged_in_client.get("/measure/complete/1?version_id=5")
|
|
assert resp.status_code == 200
|
|
html = resp.get_data(as_text=True)
|
|
assert "NaN" in html
|
|
assert "2.500" in html # la quota misurata resta formattata
|