Add validation and test coverage for tensorstore_cache_bytes edge cases#60
Add validation and test coverage for tensorstore_cache_bytes edge cases#60rhoadesScholar merged 4 commits intocache_boundfrom
Conversation
…alues Co-authored-by: rhoadesScholar <37990507+rhoadesScholar@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR addresses unresolved review comments from PR #59 by adding validation and test coverage for tensorstore_cache_bytes parameter edge cases in the CellMapDataLoader. The changes ensure that invalid values (negative numbers, non-integers from environment variables) are properly rejected with clear error messages, and that the special case of zero (which disables caching) is explicitly tested and documented.
Changes:
- Added validation to reject negative
tensorstore_cache_bytesvalues from both direct parameters and theCELLMAP_TENSORSTORE_CACHE_BYTESenvironment variable - Added test coverage for
tensorstore_cache_bytes=0to verify it correctly disables TensorStore's in-memory cache - Added comprehensive validation tests for negative values and invalid environment variable inputs
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/cellmap_data/dataloader.py | Added negative value validation check (lines 173-176) and formatting improvements (blank lines) |
| tests/test_dataloader.py | Added 4 new test methods covering zero-byte cache behavior and validation of negative/invalid inputs |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## cache_bound #60 +/- ##
===============================================
+ Coverage 70.28% 70.38% +0.09%
===============================================
Files 28 28
Lines 2628 2630 +2
===============================================
+ Hits 1847 1851 +4
+ Misses 781 779 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Addresses unresolved review comments from PR #59 regarding validation and test coverage for
tensorstore_cache_bytesparameter edge cases.Changes
Added negative value validation: Raises
ValueErrorwhentensorstore_cache_bytes < 0, either from direct parameter orCELLMAP_TENSORSTORE_CACHE_BYTESenvironment variableAdded test coverage for
tensorstore_cache_bytes=0: Verifies that zero correctly disables TensorStore's in-memory cache (per TensorStore documentation,total_bytes_limit=0disables the LRU cache)Added validation tests:
Example Usage
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.