TST: Add tests for shepard_fallback in test_function_grid.py#879
Merged
aZira371 merged 2 commits intocopilot/enhance-drag-curve-functionalityfrom Nov 27, 2025
Merged
Conversation
Co-authored-by: aZira371 <99824864+aZira371@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update test_function_grid.py to include tests for shepard_fallback
TST: Add tests for shepard_fallback in test_function_grid.py
Nov 27, 2025
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## copilot/enhance-drag-curve-functionality #879 +/- ##
============================================================================
+ Coverage 80.25% 80.38% +0.12%
============================================================================
Files 104 104
Lines 12912 12912
============================================================================
+ Hits 10363 10379 +16
+ Misses 2549 2533 -16 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
aZira371
approved these changes
Nov 27, 2025
8572b1e
into
copilot/enhance-drag-curve-functionality
26 checks passed
Gui-FernandesBR
pushed a commit
that referenced
this pull request
Nov 27, 2025
* Add tests for shepard_fallback in test_function_grid.py Co-authored-by: aZira371 <99824864+aZira371@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: aZira371 <99824864+aZira371@users.noreply.github.com>
Gui-FernandesBR
added a commit
that referenced
this pull request
Dec 3, 2025
…f M, Re, α) (#875) * Add grid interpolation support to Function class with from_grid() method Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com> * Add multi-dimensional drag coefficient support to Flight class and integration tests Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com> * Run ruff format on modified files Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com> * MNt: refactoring get_drag_coefficient in flight.py - MNT: velocity_body was not being used in get_drag_coefficient, removed it as an input * MNT: refactoring in flight.py and lint corrections to function.py and test_multidim_drag.py -MNT: removed unused velocity in body frame parameter requirement from all instances of get_drag_coefficient in flight.py - MNT: corrected docstring for get_value_opt_grid in function.py - MNT: shifted import of classes before the definition of functions in test_multidim_drag.py * MNT: refactoring flight.py to remove unused parameters * MNT: correction of docstring function.py - MNT: rearranged the docstring of from_grid in function.py to match the expected output of doctest * MNT: make format and lint corrections to function.py - MNT: reran make format and lint on function.py to correct after previous changes to from_grid * MNT: pylint adjustments for new methods in function.py - MNT: disables pylint unused private member for get_value_opt_grid as it is called upon dynamically by from_grid - MNT: disabled pylint too many statement for from_grid for now and added a to-do to refactor it into smaller methods/helper functions - MNT: updated .pylintrc to record Re as good name * MNt: make format after previous change to function.py * MNT: removed Re where unused in test_multidim_drag.py - MNT: Re variable was unused in test_3d_drag_with_varying_alpha thus replaced it * TST: Add tests for shepard_fallback in test_function_grid.py (#879) * Add tests for shepard_fallback in test_function_grid.py Co-authored-by: aZira371 <99824864+aZira371@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: aZira371 <99824864+aZira371@users.noreply.github.com> * TST: test_multidim_drag.py - TST: Added integration-level check to verify the flight simulation actually uses alpha when evaluating multi dim drag coeff. - TST: utilized pytest fixtures where possible. * MNT: addition of is_multidimensional to function.py - MNT: Function.is_multidimensional property in function.py. It returns True when the function's internal domain dimension is greater than 1 and safely returns False on errors. - MNT: Replaced the ad-hoc hasattr/len check in flight.py with a clearer check: if isinstance and drag_function.is_multidimensional * MNT: Added validation in from_grid in function.py to raise a ValueError when an unsupported extrapolation value is provided. * ENH: Added alpha-sensitive flight fixtures to flight_fixtures.py ENH: Used shared flight fixtures and simplify multi-drag integration tests in test_multidim_drag.py ENH: Exposes multidimensionality and validated grid extrapolation in function.py * MNT: renamed linear_grid to regular_grid for easy to understand nomenclature - MNT: added a fallback to reynolds calculation in flight.py to avoid mu is zero case - MNT: updated test_shepard_fallback_warning name and docstring to match implementation in test_function_grid.py * MNT: replaced the broad except Exception: with except (TypeError, ValueError, OverflowError): in get_drag_coefficient of flight.py * TST: added from_grid unit tests to cover constructor-level validation and the explicit API. * MNT: format and lint update to test_function_from_grid.py * DOC: changelog.md update for multidim drag * Address review feedback: add unsorted axis warning, flatten_for_compatibility parameter, and early return guard clause Co-authored-by: aZira371 <99824864+aZira371@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com> Co-authored-by: Ishan <99824864+aZira371@users.noreply.github.com> Co-authored-by: Ishan <dubeyishan371@gmail.com>
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.
Pull request type
Checklist
black rocketpy/ tests/) has passed locallypytest tests -m slow --runslow) have passed locallyCurrent behavior
The
test_function_grid.pyfile testsFunction.from_grid()andlinear_gridinterpolation, but lacks coverage for theshepard_fallbackpath that triggers whenlinear_gridis set without a grid interpolator.New behavior
Added 4 tests for
shepard_fallback:test_shepard_fallback_warning- Verifies warning emission when fallback triggerstest_shepard_fallback_2d_interpolation- Validates 2D interpolation matches standard shepardtest_shepard_fallback_3d_interpolation- Validates 3D interpolation matches standard shepardtest_shepard_fallback_at_exact_data_points- Confirms exact values at data pointsBreaking change
Additional information
Addresses review feedback from PR #875 requesting test coverage for
shepard_fallback.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.