fix(tests): make cellxgene repr_dict robust to a spurious None layer key (#265)#266
Open
Elarwei001 wants to merge 1 commit into
Open
fix(tests): make cellxgene repr_dict robust to a spurious None layer key (#265)#266Elarwei001 wants to merge 1 commit into
Elarwei001 wants to merge 1 commit into
Conversation
…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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #265
Summary
tests/test_cellxgene.py::TestCellxgene::test_cellxgene_adatastarted failing on py3.12/3.13 (it is skipped on py3.14, wherecellxgene-censushas no wheel) due to upstream drift, not any change in gget:cellxgene-census'sget_anndata()now returns an AnnData whose.layersexposes a spuriousNonekey. The test'srepr_dict()helper turned that into"layers": [None], which no longer matched the stored expected structure.Fix
repr_dict()now ignoresNonekeys when summarising an AnnData's structure, so the comparison stays on meaningful (named) elements and is robust to this drift. Thetest_cellxgene_adatafixture is left unchanged (no need to hard-code the spurious[None]). This is a test-only change — nogget/code is touched.Testing
Unit tests (offline, no
cellxgene-censusneeded):TestReprDict::test_repr_dict_ignores_none_layer_key— a fake AnnData with aNone-keyed layer must not surfacelayers, while namedobs/varelements still do. Runs on every Python version, so it guards the fix even where the live Census tests are skipped.Live tests (
test_cellxgene_adataetc.):repr_dictignores theNonelayer. I could not run them locally (local env is py3.14 withoutcellxgene-census), so CI on this PR is the confirmation.