PteraSoftware
PteraSoftware copied to clipboard
Add tests for analyze_unsteady_trim
Problem Statement
analyze_unsteady_trim() has no dedicated unit or integration tests.
Location(s): pterasoftware/trim.py
Proposed Solution
Add unit tests and integration tests for analyze_unsteady_trim().
Additional Context
This issue is referenced by TEST comments in analyze_unsteady_trim().
@camUrban Happy to work on this. Let me know. Thank you.
@20086080 absolutely! This will likely be a bit more hefty than the other issues you've tackled as it's a bigger, more complicated module. You've done a great job with the last two PRs so you'll definitely be able to handle it.
Some quick advice before you get started:
- I'd start with unit tests, which will cover things like parameter validation. As for what to validate, look in
analyze_unsteady_trim's docstring's parameters section. The descriptions describe requirements for the parameters, which are checked in the first part of the function. You can test these by passing parameters that don't meet the requirements and verifying that an error is thrown, and vise versa. You can see examples of this type of testtest_wing.py'stest_wing_cross_sections_validationandtest_initialization_valid_parametersmethods. - This function takes in an
UnsteadyProblemobject, which require a lot of boilerplate to create. Therefore, it will be easiest to import one as a fixture fromtests/unit/fixtures/problem_fixtures.py - Before starting on the integration test, if you haven't done so already, I'd walk through the
SteadyHorseshoeVortexLatticeMethodSolverexample, the static-geometryUnsteadyRingVortexLatticeMethodSolverexample, and finally theanalze_unsteady_trimexample. - You'll want to add the integration test in a separate module in
test/integration/. Here, I'd start by copying verbatim theanalyze_steady_trimintegration test. The only thing you should need to change is insetUp: after making theAirplaneandOperatingPointobjects you'll want to make staticAirplaneMovementandOperatingPointMovementobjects, which you can use to create anUnsteadyProblem. - Integration tests that actually check against known values can be a bit fiddly, so we may need to modify the expected results, but they should be close to the results for
analyze_steady_trimif the geometry is the same.