Skip to content

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
pankaj-bind:fix/dead-tests-test-weather
Open

fix(test): correct dead test functions for get_u/get_v in test_weather.py#160
pankaj-bind wants to merge 2 commits into52North:mainfrom
pankaj-bind:fix/dead-tests-test-weather

Conversation

@pankaj-bind
Copy link
Copy Markdown
Contributor

@pankaj-bind pankaj-bind commented Mar 7, 2026

Related Issue / Discussion:

Fixes Issue #161

Changes:

  • Modified test_weather.py

Further Details:

Summary:

get_u() and get_v() in test_weather.py had 5 compounding defects that made them dead code:

  1. Missing test_ prefix - pytest never collected them
  2. @parametrize declared 3 params but signatures accepted 2
  3. Assertions compared results to themselves (u_test == pytest.approx(u_test))
  4. Expected values were wrong (-1 instead of -√2/2 for sin(45°))
  5. get_v's parametrize string said u_res instead of v_res

Before: 4 tests collected, get_u/get_v never 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

Copilot AI review requested due to automatic review settings March 7, 2026 17:26
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@pankaj-bind pankaj-bind changed the title fix: correct dead test functions for get_u/get_v in test_weather.py fix(test): correct dead test functions for get_u/get_v in test_weather.py Mar 7, 2026
@kdemmich kdemmich added the bug Something isn't working label Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants