Skip to content

test: add coverage for _haversine and _check_input_parameters - #12

Merged
TheGreatAlgo merged 1 commit into
mainfrom
test/geotemporal-utils-coverage
Jul 8, 2026
Merged

test: add coverage for _haversine and _check_input_parameters#12
TheGreatAlgo merged 1 commit into
mainfrom
test/geotemporal-utils-coverage

Conversation

@TheGreatAlgo

@TheGreatAlgo TheGreatAlgo commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Adds unit tests for two previously-untested geotemporal utilities in geotemporal_data.py:

  • _haversine — single-point and vectorized (array) distance calculations
  • _check_input_parameters — invalid time-period and aggregation-method validation

These tests are salvaged from #4, which was written against the pre-restructure dclimate_zarr_client package. The bulk of that PR targeted the old IPNS/STAC catalog traversal code that has since been removed/rewritten, but these two utilities still exist and were not covered by the current suite.

4 passed in 0.35s

Summary by CodeRabbit

  • Tests
    • Added coverage for geotemporal utility calculations, including single-point and vectorized distance results.
    • Added validation checks to confirm unsupported time periods and aggregation methods raise the expected errors.

Salvaged from #4, which was written against the pre-restructure
dclimate_zarr_client package and is otherwise obsolete. These two
utilities still exist in geotemporal_data.py and were previously
untested.
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0f3b7a9b-7da0-4f38-9ff4-bbf107f581d4

📥 Commits

Reviewing files that changed from the base of the PR and between 1369acd and 4993876.

📒 Files selected for processing (1)
  • tests/test_geotemporal_utils.py

📝 Walkthrough

Walkthrough

Adds a new test module for geotemporal utilities, covering the _haversine function with scalar and array inputs, and _check_input_parameters for invalid time_period and agg_method values, verifying expected exceptions are raised.

Changes

Geotemporal Utility Tests

Layer / File(s) Summary
Haversine distance tests
tests/test_geotemporal_utils.py
Tests validate _haversine against expected approximate kilometer distances for both scalar and NumPy array coordinate inputs.
Input parameter validation tests
tests/test_geotemporal_utils.py
Tests confirm _check_input_parameters raises InvalidTimePeriodError and InvalidAggregationMethodError for unsupported values.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: added test coverage for _haversine and _check_input_parameters.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/geotemporal-utils-coverage

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@TheGreatAlgo
TheGreatAlgo merged commit 54b8dab into main Jul 8, 2026
4 checks passed
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