Skip to content

[test] Add unit tests for algorithms/data_utils.py#168

Open
adity1raut wants to merge 2 commits into52North:mainfrom
adity1raut:test/add-unit-tests-data-utils
Open

[test] Add unit tests for algorithms/data_utils.py#168
adity1raut wants to merge 2 commits into52North:mainfrom
adity1raut:test/add-unit-tests-data-utils

Conversation

@adity1raut
Copy link
Copy Markdown

@adity1raut adity1raut commented Mar 9, 2026

Related Issue / Discussion:

Changes:

  • New tests/test_data_utils.py — unit test file for
    WeatherRoutingTool/algorithms/data_utils.py

Further Details:

Summary:

data_utils.py contains 5 testable units (get_closest, distance,
time_diffs, get_speed_from_arrival_time, and GridMixin) that had
zero test coverage before this PR.

This PR adds tests/test_data_utils.py with 44 unit tests organized
into pytest classes with shared fixtures and pytest.mark.parametrize.
Key assertions use analytically known WGS-84 geodesic values
(1° longitude on the equator ≈ 111 319.49 m) so tests are fully
self-contained and do not depend on external data files.

Class Function(s) covered Tests
TestGetClosest get_closest() 7
TestDistance distance() 7
TestTimeDiffs time_diffs() 7
TestGetSpeedFromArrivalTime get_speed_from_arrival_time() 9
TestGridMixin index_to_coords, coords_to_index, get_shuffled_cost 10

Before: no tests for data_utils.py.
After: 44 passing unit tests with full coverage of all public functions.

Screenshot From 2026-03-10 20-41-20

Dependencies:

No new dependencies. All imports (numpy, pytest, xarray,
astropy) are already listed in requirements.test.txt.

PR Checklist:

In the context of this PR, I:

[test] Add unit tests for algorithms/data_utils.py

Signed-off-by: Aditya Raut <araut7798@gmail.com>
[test] Add unit tests for algorithms/data_utils.py

Signed-off-by: Aditya Raut <araut7798@gmail.com>
@kdemmich
Copy link
Copy Markdown
Collaborator

Thank you for your PR. We appreciate the time and effort that was put into it. Please be aware that we require to follow 52 North's CLA guidelines for all PRs and, in particular, fill the 52°North Contributor License Agreement. As long as this has not been filled, I can not assign you to any issues or merge any PRs. Please don't hesitate to contact me in case of related questions.

@kdemmich kdemmich added the question Further information is requested label Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

question Further information is requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants