test: cover utils helpers and xsg accessor; fix deprecations#124
Open
Divyateja2709 wants to merge 1 commit intoioos:mainfrom
Open
test: cover utils helpers and xsg accessor; fix deprecations#124Divyateja2709 wants to merge 1 commit intoioos:mainfrom
Divyateja2709 wants to merge 1 commit intoioos:mainfrom
Conversation
- Add tests for format_bytes, asdatetime, compute_2d_subset_mask, and utils.assign_ugrid_topology forwarding with DeprecationWarning - Add accessor tests for unknown-grid warning and None subset behavior - Fix warnings.warn argument order in assign_ugrid_topology; correct message - Coerce polygon coords via np.asarray in normalize_polygon_x_coords - Define zarr__version__ when fsspec/zarr import fails (test collection) Made-with: Cursor
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.
This PR improves test coverage and reliability by adding unit tests for utility functions and accessor behavior, along with small fixes to ensure correct warnings and robust handling of inputs.
Changes
Tests
Added
tests/test_utils.py:format_bytesasdatetime(None,datetime,cftime, ISO string)compute_2d_subset_mask(full vs partial coverage)utils.assign_ugrid_topology(deprecation + delegation)Added
tests/test_accessor.py:Tests
ds.xsgbehavior when no grid is recognized:subset_polygonandsubset_bboxreturnNonesubset_varspassthroughhas_vertical_levelsbehaviorUpdated
tests/test_grids/test_sgrid.py:zarr__version__ = 0when optional dependencies are missingNameError)Fixes / Improvements
Deprecation handling
warnings.warn(...)with proper signature andstacklevel=2assign_ugrid_topologycorrectlyInput robustness
normalize_polygon_x_coordsnow coerces inputs usingnp.asarray(poly)Why this matters
Notes
docs/readme-quickstart-fixes)