Skip to content

Commit e1a60f3

Browse files
committed
FIX: mistake in parameter syntax of labeling assert.
1 parent cf9ac95 commit e1a60f3

1 file changed

Lines changed: 48 additions & 44 deletions

File tree

tests/test_flight.py

Lines changed: 48 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -711,15 +711,15 @@ def test_rail_buttons_forces(flight_calisto_custom_wind):
711711

712712

713713
@pytest.mark.parametrize(
714-
"params",
714+
"flight_time, expected_values",
715715
[
716-
("t_initial", 0, 0, 0),
717-
("out_of_rail_time", 0, 7.8068, 89.2325),
718-
("apogee_time", 0.07534, -0.058127, -9.614386),
719-
("t_final", 0, 0, 0.0017346294117130806),
716+
("t_initial", (0, 0, 0)),
717+
("out_of_rail_time", (0, 7.8068, 89.2325)),
718+
("apogee_time", (0.07534, -0.058127, -9.614386)),
719+
("t_final", (0, 0, 0.0017346294117130806)),
720720
],
721721
)
722-
def test_accelerations(flight_calisto_custom_wind, params):
722+
def test_accelerations(flight_calisto_custom_wind, flight_time, expected_values):
723723
"""Tests if the acceleration in some particular points of the trajectory is
724724
correct. The expected values were NOT calculated by hand, it was just
725725
copied from the test results. The results are not expected to change,
@@ -732,28 +732,29 @@ def test_accelerations(flight_calisto_custom_wind, params):
732732
atol : float, optional
733733
The absolute tolerance error, by default 5e-3
734734
"""
735-
expected_attr, *expected_acc = params
735+
expected_attr, expected_acc = flight_time, expected_values
736736

737737
test = flight_calisto_custom_wind
738738
t = getattr(test, expected_attr)
739739
atol = 5e-3
740740

741-
assert (
742-
pytest.approx(expected_acc, abs=atol) == (test.ax(t), test.ay(t), test.az(t)),
743-
f"Assertion error for acceleration vector at {expected_attr}.",
744-
)
741+
assert pytest.approx(expected_acc, abs=atol) == (
742+
test.ax(t),
743+
test.ay(t),
744+
test.az(t),
745+
), f"Assertion error for acceleration vector at {expected_attr}."
745746

746747

747748
@pytest.mark.parametrize(
748-
"params",
749+
"flight_time, expected_values",
749750
[
750-
("t_initial", 0, 0, 0),
751-
("out_of_rail_time", 0, 2.248727, 25.703072),
752-
("apogee_time", -13.209436, 16.05115, -0.000257),
753-
("t_final", 5, 2, -5.334289),
751+
("t_initial", (0, 0, 0)),
752+
("out_of_rail_time", (0, 2.248727, 25.703072)),
753+
("apogee_time", (-13.209436, 16.05115, -0.000257)),
754+
("t_final", (5, 2, -5.334289)),
754755
],
755756
)
756-
def test_velocities(flight_calisto_custom_wind, params):
757+
def test_velocities(flight_calisto_custom_wind, flight_time, expected_values):
757758
"""Tests if the velocity in some particular points of the trajectory is
758759
correct. The expected values were NOT calculated by hand, it was just
759760
copied from the test results. The results are not expected to change,
@@ -766,28 +767,29 @@ def test_velocities(flight_calisto_custom_wind, params):
766767
atol : float, optional
767768
The absolute tolerance error, by default 5e-3
768769
"""
769-
expected_attr, *expected_vel = params
770+
expected_attr, expected_vel = flight_time, expected_values
770771

771772
test = flight_calisto_custom_wind
772773
t = getattr(test, expected_attr)
773774
atol = 5e-3
774775

775-
assert (
776-
pytest.approx(expected_vel, abs=atol) == (test.vx(t), test.vy(t), test.vz(t)),
777-
f"Assertion error for velocity vector at {expected_attr}.",
778-
)
776+
assert pytest.approx(expected_vel, abs=atol) == (
777+
test.vx(t),
778+
test.vy(t),
779+
test.vz(t),
780+
), f"Assertion error for velocity vector at {expected_attr}."
779781

780782

781783
@pytest.mark.parametrize(
782-
"params",
784+
"flight_time, expected_values",
783785
[
784-
("t_initial", 1.6542528, 0.65918, -0.067107),
785-
("out_of_rail_time", 5.05334, 2.01364, -1.7541),
786-
("apogee_time", 2.35291, -1.8275, -0.87851),
787-
("t_final", 0, 0, 141.42421),
786+
("t_initial", (1.6542528, 0.65918, -0.067107)),
787+
("out_of_rail_time", (5.05334, 2.01364, -1.7541)),
788+
("apogee_time", (2.35291, -1.8275, -0.87851)),
789+
("t_final", (0, 0, 141.42421)),
788790
],
789791
)
790-
def test_aerodynamic_forces(flight_calisto_custom_wind, params):
792+
def test_aerodynamic_forces(flight_calisto_custom_wind, flight_time, expected_values):
791793
"""Tests if the aerodynamic forces in some particular points of the
792794
trajectory is correct. The expected values were NOT calculated by hand, it
793795
was just copied from the test results. The results are not expected to
@@ -800,28 +802,29 @@ def test_aerodynamic_forces(flight_calisto_custom_wind, params):
800802
atol : float, optional
801803
The absolute tolerance error, by default 5e-3
802804
"""
803-
expected_attr, *expected_R = params
805+
expected_attr, expected_R = flight_time, expected_values
804806

805807
test = flight_calisto_custom_wind
806808
t = getattr(test, expected_attr)
807809
atol = 5e-3
808810

809-
assert (
810-
pytest.approx(expected_R, abs=atol) == (test.R1(t), test.R2(t), test.R3(t)),
811-
f"Assertion error for aerodynamic forces vector at {expected_attr}.",
812-
)
811+
assert pytest.approx(expected_R, abs=atol) == (
812+
test.R1(t),
813+
test.R2(t),
814+
test.R3(t),
815+
), f"Assertion error for aerodynamic forces vector at {expected_attr}."
813816

814817

815818
@pytest.mark.parametrize(
816-
"params",
819+
"flight_time, expected_values",
817820
[
818-
("t_initial", 0.17179073815516033, -0.431117, 0),
819-
("out_of_rail_time", 0.547026, -1.3727895, 0),
820-
("apogee_time", -0.5874848151271623, -0.7563596, 0),
821-
("t_final", 0, 0, 0),
821+
("t_initial", (0.17179073815516033, -0.431117, 0)),
822+
("out_of_rail_time", (0.547026, -1.3727895, 0)),
823+
("apogee_time", (-0.5874848151271623, -0.7563596, 0)),
824+
("t_final", (0, 0, 0)),
822825
],
823826
)
824-
def test_aerodynamic_moments(flight_calisto_custom_wind, params):
827+
def test_aerodynamic_moments(flight_calisto_custom_wind, flight_time, expected_values):
825828
"""Tests if the aerodynamic moments in some particular points of the
826829
trajectory is correct. The expected values were NOT calculated by hand, it
827830
was just copied from the test results. The results are not expected to
@@ -834,13 +837,14 @@ def test_aerodynamic_moments(flight_calisto_custom_wind, params):
834837
atol : float, optional
835838
The absolute tolerance error, by default 5e-3
836839
"""
837-
expected_attr, *expected_M = params
840+
expected_attr, expected_M = flight_time, expected_values
838841

839842
test = flight_calisto_custom_wind
840843
t = getattr(test, expected_attr)
841844
atol = 5e-3
842845

843-
assert (
844-
pytest.approx(expected_M, abs=atol) == (test.M1(t), test.M2(t), test.M3(t)),
845-
f"Assertion error for moment vector at {expected_attr}.",
846-
)
846+
assert pytest.approx(expected_M, abs=atol) == (
847+
test.M1(t),
848+
test.M2(t),
849+
test.M3(t),
850+
), f"Assertion error for moment vector at {expected_attr}."

0 commit comments

Comments
 (0)