Skip to content

fix(tests): make cellxgene repr_dict robust to a spurious None layer key (#265)#266

Open
Elarwei001 wants to merge 1 commit into
scverse:devfrom
Elarwei001:fix-cellxgene-layers
Open

fix(tests): make cellxgene repr_dict robust to a spurious None layer key (#265)#266
Elarwei001 wants to merge 1 commit into
scverse:devfrom
Elarwei001:fix-cellxgene-layers

Conversation

@Elarwei001

Copy link
Copy Markdown
Contributor

Resolves #265

Summary

tests/test_cellxgene.py::TestCellxgene::test_cellxgene_adata started failing on py3.12/3.13 (it is skipped on py3.14, where cellxgene-census has no wheel) due to upstream drift, not any change in gget: cellxgene-census's get_anndata() now returns an AnnData whose .layers exposes a spurious None key. The test's repr_dict() helper turned that into "layers": [None], which no longer matched the stored expected structure.

Fix

repr_dict() now ignores None keys when summarising an AnnData's structure, so the comparison stays on meaningful (named) elements and is robust to this drift. The test_cellxgene_adata fixture is left unchanged (no need to hard-code the spurious [None]). This is a test-only change — no gget/ code is touched.

Testing

Unit tests (offline, no cellxgene-census needed):

  • new TestReprDict::test_repr_dict_ignores_none_layer_key — a fake AnnData with a None-keyed layer must not surface layers, while named obs/var elements still do. Runs on every Python version, so it guards the fix even where the live Census tests are skipped.

Live tests (test_cellxgene_adata etc.):

  • unchanged; they exercise the real Census on py3.12/3.13 and should pass again now that repr_dict ignores the None layer. I could not run them locally (local env is py3.14 without cellxgene-census), so CI on this PR is the confirmation.

…verse#265)

cellxgene-census now returns an AnnData whose .layers exposes a None key,
which repr_dict surfaced as 'layers': [None] and broke the structural
comparison in test_cellxgene_adata. repr_dict now ignores None keys, so the
comparison stays on meaningful (named) elements and is robust to this
upstream drift. Adds a network-free TestReprDict test that guards the
behavior on every Python version (the live Census tests skip where
cellxgene-census has no wheel).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov-commenter

codecov-commenter commented Jul 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.31%. Comparing base (e43a804) to head (0bd7c3d).
⚠️ Report is 2 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #266      +/-   ##
==========================================
- Coverage   56.70%   56.31%   -0.40%     
==========================================
  Files          29       29              
  Lines        9392     9392              
==========================================
- Hits         5326     5289      -37     
- Misses       4066     4103      +37     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants