Skip to content

Commit 5f917f2

Browse files
MateusStanoclaude
andcommitted
TST: build a real Solution in the core-event-builder integration test
apogee_trigger now reads the previous state through flight.solution, so the hand-built mock must use a Solution instead of a plain list of rows. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 1cb0bb4 commit 5f917f2

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

tests/integration/simulation/test_event.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,19 @@ def _sample_state(time, vz):
8989
)
9090

9191

92+
def _canonical_solution(*rows):
93+
"""Build a Solution holding the given canonical rows in one segment."""
94+
from rocketpy.simulation.solution import CANONICAL_SCHEMA, Solution
95+
96+
solution = Solution()
97+
solution.start_segment(
98+
CANONICAL_SCHEMA, start_canonical=tuple(rows[0][1:]) if rows else None
99+
)
100+
for row in rows:
101+
solution.append(list(row))
102+
return solution
103+
104+
92105
def _interpolator(time):
93106
return np.array(
94107
[1.0 - 2.0 * time, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
@@ -331,7 +344,9 @@ def test_core_event_builders_update_flight_state_and_commands():
331344
z_impact=None,
332345
impact_velocity=None,
333346
impact_time=None,
334-
solution=[_sample_state(0.0, 1.0), _sample_state(1.0, -1.0)],
347+
solution=_canonical_solution(
348+
_sample_state(0.0, 1.0), _sample_state(1.0, -1.0)
349+
),
335350
u_dot_generalized=lambda *_args, **_kwargs: "new-derivative",
336351
)
337352

0 commit comments

Comments
 (0)