Skip to content

Commit 1dfd06e

Browse files
CopilotaZira371
andcommitted
Fix test logic issues based on code review feedback
Co-authored-by: aZira371 <99824864+aZira371@users.noreply.github.com>
1 parent 2c4379f commit 1dfd06e

1 file changed

Lines changed: 20 additions & 9 deletions

File tree

tests/acceptance/test_3dof_flight.py

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -398,21 +398,29 @@ def test_3dof_flight_mass_variation(flight_3dof_no_weathercock):
398398
"""
399399
flight = flight_3dof_no_weathercock
400400

401-
# Get initial mass
401+
# Get initial mass (at t=0)
402402
initial_mass = flight.rocket.total_mass(0)
403403

404404
# Get mass during burn (at t=1s)
405-
burn_mass = flight.rocket.total_mass(1.0)
405+
mass_during_burn = flight.rocket.total_mass(1.0)
406406

407407
# Get mass after burnout (at t=5s, after 3.5s burn time)
408408
post_burn_mass = flight.rocket.total_mass(5.0)
409409

410-
# Initial mass should be greater than burn mass
411-
assert initial_mass > burn_mass, "Mass should decrease during burn"
410+
# Initial mass should be greater than mass during burn
411+
assert initial_mass > mass_during_burn, "Mass should decrease during burn"
412412

413-
# Post-burn mass should equal burn-out mass (motor dry mass)
414-
# Allow small tolerance for numerical precision
415-
assert abs(burn_mass - post_burn_mass) < 0.01, (
413+
# Mass during burn should be greater than post-burn mass
414+
# (propellant is still being consumed)
415+
assert mass_during_burn > post_burn_mass, (
416+
"Mass should continue decreasing until burnout"
417+
)
418+
419+
# Mass should remain constant after burnout
420+
# Check at t=6s and t=7s to verify constant mass
421+
mass_at_6s = flight.rocket.total_mass(6.0)
422+
mass_at_7s = flight.rocket.total_mass(7.0)
423+
assert abs(mass_at_6s - mass_at_7s) < 0.001, (
416424
"Mass should remain constant after burnout"
417425
)
418426

@@ -528,7 +536,10 @@ def test_3dof_flight_different_weathercock_coefficients(
528536
)
529537

530538
# Apogees should vary with weathercock coefficient
539+
# Calculate the range of apogees to ensure they're different
531540
apogees = [f.apogee for f in flights]
532-
assert len(set(np.round(apogees, 1))) > 1, (
533-
"Different weathercock coefficients should produce different apogees"
541+
apogee_range = max(apogees) - min(apogees)
542+
assert apogee_range > 1.0, (
543+
f"Different weathercock coefficients should produce different apogees. "
544+
f"Range was only {apogee_range:.2f} m"
534545
)

0 commit comments

Comments
 (0)