Skip to content

test: check annotations DataFrame columns by name, not strict shape[1] == 5#43

Open
ppavlidis wants to merge 1 commit into
masterfrom
fix/test-annotations-column-count
Open

test: check annotations DataFrame columns by name, not strict shape[1] == 5#43
ppavlidis wants to merge 1 commit into
masterfrom
fix/test-annotations-column-count

Conversation

@ppavlidis

Copy link
Copy Markdown

Summary

  • test_get_dataset_annotations has been one column behind since gemmapy commit fb7afb8 ("add evidence code to annotation processing") added evidence_code to the DataFrame projection without updating the test's shape[1] == 5 assertion.
  • Replace the bare column-count check with an expected-column-name subset assertion. The intent of the test (ensure the expected columns are present) is preserved; the brittle "exactly 5 columns" rigidity is removed.
  • Drives compatibility forward — server-side additive fields on /datasets/{id}/annotations will not break this test the next time something is added.

Why this matters

While auditing v1/v2 API compatibility between the current gemma-rest (2.0.0-alpha-SNAPSHOT) and gemmapy / gemma.R, this was the only gemmapy test that failed against a fresh local container. 10/11 test_basic.py tests pass; this one fails purely because the assertion is rigid against an additive change that already landed on both sides.

Server-side wire shape is unchanged from gemmapy's perspective. No new client-visible field; this is purely a test-fixture update.

Test plan

  • Run the test against a local Gemma container http://localhost:8080/rest/v2 — passes.
  • Wait for CI to pick it up against staging / prod.

``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) <noreply@anthropic.com>
EOF
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant