From 9ea1509dc0e0c805ccbc65032ba75b71aaa9b367 Mon Sep 17 00:00:00 2001 From: Paul Pavlidis Date: Sun, 7 Jun 2026 16:14:53 -0700 Subject: [PATCH] test: check expected columns by name instead of strict shape[1] == 5 ``test_get_dataset_annotations`` asserted ``res.shape[1] == 5`` against the gemma-rest ``/datasets/{id}/annotations`` response. gemmapy commit ``fb7afb8`` ("add evidence code to annotation processing") added ``evidence_code`` to the DataFrame projection but didn't update this test, so the assertion has been one column behind (now 6 cols, asserts == 5). Replace the bare shape[1] check with an expected-column-name subset assertion. Verifies the columns we care about are present without breaking the next time gemma-rest emits an additive field, which is the contract direction (server-side additive fields are backwards-compatible for clients that don't strict-check column counts. Co-Authored-By: Claude Opus 4.7 (1M context) EOF ) --- tests/test_basic.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/test_basic.py b/tests/test_basic.py index 5c19dbd..d7fb502 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -104,7 +104,14 @@ def test_search_annotations(): def test_get_dataset_annotations(): res = api.get_dataset_annotations(1) assert type(res) is pd.core.frame.DataFrame - assert res.shape[1] == 5 + # Expected columns. evidence_code was added in fb7afb8 ("add evidence + # code to annotation processing") but the test's bare shape[1] == 5 + # assertion wasn't updated, so it failed once gemma-rest started + # emitting evidenceCode. Check by name instead of count so future + # additive fields don't break this test the same way. + expected = {"class_name", "class_URI", "term_name", "term_URI", + "object_class", "evidence_code"} + assert expected.issubset(set(res.columns)) def test_get_dataset_differential_expression_analyses(): res = api.get_dataset_differential_expression_analyses(200)