fix(test): correct dead test functions for get_u/get_v in test_weather.py#160
Open
pankaj-bind wants to merge 2 commits into52North:mainfrom
Open
fix(test): correct dead test functions for get_u/get_v in test_weather.py#160pankaj-bind wants to merge 2 commits into52North:mainfrom
pankaj-bind wants to merge 2 commits into52North:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes and expands unit tests in tests/test_weather.py so that WeatherCond.get_u() / get_v() are actually collected by pytest and correctly validate the degree-based wind-direction math used by WeatherCond.
Changes:
- Renamed previously “dead” test functions to be pytest-collectable and corrected parameterization/signatures and assertions.
- Corrected expected values for key angles (including 45° cases) and added cardinal-direction test cases.
- Added additional invariants: vector magnitude equals
|windspeed|and u/v → theta round-trip consistency.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Related Issue / Discussion:
Fixes Issue #161
Changes:
Further Details:
Summary:
get_u()andget_v()in test_weather.py had 5 compounding defects that made them dead code:test_prefix - pytest never collected them@parametrizedeclared 3 params but signatures accepted 2u_test == pytest.approx(u_test))-1instead of-√2/2forsin(45°))get_v's parametrize string saidu_resinstead ofv_resBefore: 4 tests collected,
get_u/get_vnever executed.After: 39 tests collected, all passing. Added cardinal-direction cases (0°, 90°, 180°, 270°) with textbook-exact values, magnitude invariant tests (
√(u²+v²) = |windspeed|), and round-trip consistency tests (get_theta_from_uv(get_u(θ), get_v(θ)) == θ).No production code changed.
Dependencies:
None
PR Checklist:
In the context of this PR, I:
Please consider that PRs which do not meet the requirements specified in the checklist will not be evaluated. Also, PRs with no activities will be closed after a reasonable amount of time.
@MartinPontius @kdemmich