Skip to content

Commit 79e2a1c

Browse files
committed
Unit tests
Unit tests corrected.
1 parent c941070 commit 79e2a1c

3 files changed

Lines changed: 11 additions & 14 deletions

File tree

tests/integration/test_encoding.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import pytest
66

77
from rocketpy._encoders import RocketPyDecoder, RocketPyEncoder
8-
98
from rocketpy.tools import from_hex_decode
109

1110

tests/unit/test_hybridmotor.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def test_hybrid_motor_basic_parameters(hybrid_motor):
5656
assert hybrid_motor.liquid.positioned_tanks[0]["position"] == 0.3
5757

5858

59-
def test_hybrid_motor_thrust_parameters(hybrid_motor, spherical_oxidizer_tank):
59+
def test_hybrid_motor_thrust_parameters(hybrid_motor, oxidizer_tank):
6060
"""Tests the HybridMotor class thrust parameters.
6161
6262
Parameters
@@ -77,13 +77,13 @@ def test_hybrid_motor_thrust_parameters(hybrid_motor, spherical_oxidizer_tank):
7777
* GRAIN_INITIAL_HEIGHT
7878
* GRAIN_NUMBER
7979
)
80-
initial_oxidizer_mass = spherical_oxidizer_tank.fluid_mass(0)
80+
initial_oxidizer_mass = oxidizer_tank.fluid_mass(0)
8181
initial_mass = initial_grain_mass + initial_oxidizer_mass
8282

8383
expected_exhaust_velocity = expected_total_impulse / initial_mass
8484
expected_mass_flow_rate = -expected_thrust / expected_exhaust_velocity
8585
expected_grain_mass_flow_rate = (
86-
expected_mass_flow_rate - spherical_oxidizer_tank.net_mass_flow_rate
86+
expected_mass_flow_rate - oxidizer_tank.net_mass_flow_rate
8787
)
8888

8989
assert pytest.approx(hybrid_motor.thrust.y_array) == expected_thrust.y_array
@@ -100,7 +100,7 @@ def test_hybrid_motor_thrust_parameters(hybrid_motor, spherical_oxidizer_tank):
100100
) == expected_grain_mass_flow_rate(t)
101101

102102

103-
def test_hybrid_motor_center_of_mass(hybrid_motor, spherical_oxidizer_tank):
103+
def test_hybrid_motor_center_of_mass(hybrid_motor, oxidizer_tank):
104104
"""Tests the HybridMotor class center of mass.
105105
106106
Parameters
@@ -110,11 +110,11 @@ def test_hybrid_motor_center_of_mass(hybrid_motor, spherical_oxidizer_tank):
110110
spherical_oxidizer_tank : rocketpy.SphericalTank
111111
The SphericalTank object to be used in the tests.
112112
"""
113-
oxidizer_mass = spherical_oxidizer_tank.fluid_mass
113+
oxidizer_mass = oxidizer_tank.fluid_mass
114114
grain_mass = hybrid_motor.solid.propellant_mass
115115

116116
propellant_balance = grain_mass * GRAINS_CENTER_OF_MASS_POSITION + oxidizer_mass * (
117-
OXIDIZER_TANK_POSITION + spherical_oxidizer_tank.center_of_mass
117+
OXIDIZER_TANK_POSITION + oxidizer_tank.center_of_mass
118118
)
119119
balance = propellant_balance + DRY_MASS * CENTER_OF_DRY_MASS
120120

@@ -128,7 +128,7 @@ def test_hybrid_motor_center_of_mass(hybrid_motor, spherical_oxidizer_tank):
128128
assert pytest.approx(hybrid_motor.center_of_mass(t)) == center_of_mass(t)
129129

130130

131-
def test_hybrid_motor_inertia(hybrid_motor, spherical_oxidizer_tank):
131+
def test_hybrid_motor_inertia(hybrid_motor, oxidizer_tank):
132132
"""Tests the HybridMotor class inertia.
133133
134134
Parameters
@@ -138,8 +138,8 @@ def test_hybrid_motor_inertia(hybrid_motor, spherical_oxidizer_tank):
138138
spherical_oxidizer_tank : rocketpy.SphericalTank
139139
The SphericalTank object to be used in the tests.
140140
"""
141-
oxidizer_mass = spherical_oxidizer_tank.fluid_mass
142-
oxidizer_inertia = spherical_oxidizer_tank.inertia
141+
oxidizer_mass = oxidizer_tank.fluid_mass
142+
oxidizer_inertia = oxidizer_tank.inertia
143143
grain_mass = hybrid_motor.solid.propellant_mass
144144
grain_inertia = hybrid_motor.solid.propellant_I_11
145145
propellant_mass = oxidizer_mass + grain_mass
@@ -153,7 +153,7 @@ def test_hybrid_motor_inertia(hybrid_motor, spherical_oxidizer_tank):
153153
oxidizer_mass
154154
* (
155155
OXIDIZER_TANK_POSITION
156-
+ spherical_oxidizer_tank.center_of_mass
156+
+ oxidizer_tank.center_of_mass
157157
- hybrid_motor.center_of_propellant_mass
158158
)
159159
** 2

tests/unit/test_solidmotor.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,11 @@
2020

2121

2222
@patch("matplotlib.pyplot.show")
23-
def test_motor(mock_show, cesaroni_m1670): # pylint: disable=unused-argument
23+
def test_motor(cesaroni_m1670): # pylint: disable=unused-argument
2424
"""Tests the SolidMotor.all_info() method.
2525
2626
Parameters
2727
----------
28-
mock_show : mock
29-
Mock of the matplotlib.pyplot.show function.
3028
cesaroni_m1670 : rocketpy.SolidMotor
3129
The SolidMotor object to be used in the tests.
3230
"""

0 commit comments

Comments
 (0)