Skip to content

Improving unit tests #2

Merged
BenjaminIsaac0111 merged 4 commits intomainfrom
ImprovingUnitTests-
Feb 26, 2026
Merged

Improving unit tests #2
BenjaminIsaac0111 merged 4 commits intomainfrom
ImprovingUnitTests-

Conversation

@BenjaminIsaac0111
Copy link
Owner

No description provided.

…alidation

Expanded mutation testing coverage to critical modules and implemented a comprehensive suite of robustness tests to address identified logic gaps.

Key changes:

Mutation Testing: Established cosmic-ray configurations and sessions for

losses.py
,

splitting.py
,

dataset.py
, and

pathways.py
.
Bug Fix (Augmentation): Corrected operation mapping in

apply_dihedral_to_tensor
 where vertical flips (op 5) were incorrectly handled as horizontal flips (op 4).
Refactor (Normalization): Rewrote

normalize_coordinates
 to use explicit grid-step detection (np.diff), ensuring robust coordinate scaling across different spatial transcriptomics datasets and environments.
Robustness Suite: Added 12 new test cases across four modules:

tests/test_dataset_logic.py
: Validates spatial normalization and dihedral symmetry.

tests/test_splitting_robust.py
: Verifies strict patient isolation and CLI parameter integrity.

tests/test_losses_robust.py
: Confirms gradient flow for ZINB loss and numerical stability under extreme count values.

tests/test_pathways_robust.py
: Ensures integrity of gene-to-pathway adjacency matrix construction.
Data Loading Fixes: Resolved a dimension permute error in

HEST_Dataset
 and refined dataset validation logic.
- Improve test_dataset_logic.py with comprehensive verification for all 8 dihedral transformations and boundary conditions for coordinate normalization.
- Implement test_dataset_mocks.py to verify HEST_Dataset and HEST_FeatureDataset integration logic (augmentations, neighborhood dropout, log1p) using mocks.
- Fix RuntimeError in ZINBLoss.forward caused by incorrect mask expansion dimensions when using spatial padding.
@BenjaminIsaac0111 BenjaminIsaac0111 merged commit a3ffc00 into main Feb 26, 2026
2 checks passed
@BenjaminIsaac0111 BenjaminIsaac0111 deleted the ImprovingUnitTests- branch February 26, 2026 15:30
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