From a400ffc3be9c384788d64b3fc5e0ed6916947caa Mon Sep 17 00:00:00 2001 From: perl_d Date: Thu, 3 Sep 2026 12:21:32 +0200 Subject: [PATCH] fix: type checking in tests --- tests/test_gridscan_decision.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/test_gridscan_decision.py b/tests/test_gridscan_decision.py index 65ba557..cbd1cfa 100644 --- a/tests/test_gridscan_decision.py +++ b/tests/test_gridscan_decision.py @@ -31,13 +31,14 @@ def _synthetic_scan(ny_n=20, nx_n=20): return {"file_prefix": "decision-test", "images": images} -def test_decision_round_trips_without_pictures(): - th = Thresholds() +def test_decision_round_trips_without_pictures(request): + th = Thresholds.model_validate({}) r = analyse(_synthetic_scan(), {"step_x_um": 10.0, "step_y_um": 10.0}, thresholds=th) assert r.found assert r.contour_cells, "the chosen 50 % blob must ship its cells" assert all(0 <= x < r.n_fast and 0 <= y < r.n_slow for x, y in r.contour_cells) # the centre lies within the contour's bounding box + assert r.centre is not None xs = [x for x, _ in r.contour_cells] ys = [y for _, y in r.contour_cells] assert min(xs) - 1 <= r.centre.nx <= max(xs) + 1 @@ -54,8 +55,9 @@ def test_decision_round_trips_without_pictures(): assert "jpeg" not in wire["result"], "pictures never ride the JSON" assert wire["result"]["centre"]["image_number"] == r.centre.image_number assert wire["thresholds"]["object_union_spots"] is True - back = GridScanDecision.model_validate(wire) + assert back.result.centre is not None + assert back.result.contour_cells is not None assert back.result.centre.nx == r.centre.nx assert [tuple(c) for c in back.result.contour_cells] == r.contour_cells