PteraSoftware icon indicating copy to clipboard operation
PteraSoftware copied to clipboard

Add tests for analyze_unsteady_trim

Open camUrban opened this issue 8 months ago • 2 comments

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 avatar Mar 17 '26 20:03 camUrban

@camUrban Happy to work on this. Let me know. Thank you.

MonishaSikka avatar May 10 '26 13:05 MonishaSikka

@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 test test_wing.py's test_wing_cross_sections_validation and test_initialization_valid_parameters methods.
  • This function takes in an UnsteadyProblem object, which require a lot of boilerplate to create. Therefore, it will be easiest to import one as a fixture from tests/unit/fixtures/problem_fixtures.py
  • Before starting on the integration test, if you haven't done so already, I'd walk through the SteadyHorseshoeVortexLatticeMethodSolver example, the static-geometry UnsteadyRingVortexLatticeMethodSolver example, and finally the analze_unsteady_trim example.
  • You'll want to add the integration test in a separate module in test/integration/. Here, I'd start by copying verbatim the analyze_steady_trim integration test. The only thing you should need to change is in setUp: after making the Airplane and OperatingPoint objects you'll want to make static AirplaneMovement and OperatingPointMovement objects, which you can use to create an UnsteadyProblem.
  • 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_trim if the geometry is the same.

camUrban avatar May 10 '26 16:05 camUrban