[test] Add unit tests for RoutingProblem.get_power#179
[test] Add unit tests for RoutingProblem.get_power#179adity1raut wants to merge 1 commit into52North:mainfrom
Conversation
Signed-off-by: Aditya Raut <araut7798@gmail.com>
|
Hi @adity1raut, thank you for your PR. We appreciate the time and effort that was put into it. Please be aware that we require to follow 52 North's CLA guidelines for all PRs and, in particular, fill the 52°North Contributor License Agreement. As long as this has not been filled, I can not assign you to any issues or merge any PRs. Please don't hesitate to contact me in case of related questions. |
Hi, thank you for the clarification. I have now completed the 52°North Contributor License Agreement. Please let me know if anything else is required from my side. |
Related Issue / Discussion:
Relates to discussion [Improve Test Framework – GSoC 2025 Code Challenge]
Changes:
tests/test_routing_problem_get_power.pyFurther Details:
Summary:
Before:
RoutingProblem.get_powerandRoutingProblem._evaluateinWeatherRoutingTool/algorithms/genetic/problem.pyhad zero test coverage.After: 13 unit tests covering all methods of
RoutingProblemgroupedinto pytest classes, achieving 100% line coverage (34/34 statements).
Classes and tests added:
TestRoutingProblemInitboat_speed_from_arrival_timeflag set correctly for fixed speed and arrival-time modesTestGetPowerFixedSpeedTestGetPowerArrivalTimeTestEvaluateout['F']andout['G']populated,out['F']positive,out['G']zero when no constraint violations_evaluateis tested withunittest.mock.patchto isolate it fromget_constraints, which requires loaded constraint data not availablein the unit test environment.
Dependencies:
No new dependencies.
unittest.mockis part of the Python standard library.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.