-
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implements flight route tests #41
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
import json | ||
import pytest | ||
|
||
from lib.models.rocket import Rocket | ||
from lib.models.motor import Motor, MotorTank, TankFluids, TankKinds | ||
from lib.models.environment import Env | ||
|
||
|
||
@pytest.fixture | ||
def stub_env(): | ||
env = Env(latitude=0, longitude=0) | ||
env_json = env.model_dump_json() | ||
return json.loads(env_json) | ||
phmbressan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
@pytest.fixture | ||
def stub_motor(): | ||
motor = Motor( | ||
thrust_source=[[0, 0]], | ||
burn_time=0, | ||
nozzle_radius=0, | ||
dry_mass=0, | ||
dry_inertia=[0, 0, 0], | ||
center_of_dry_mass_position=0, | ||
) | ||
motor_json = motor.model_dump_json() | ||
return json.loads(motor_json) | ||
|
||
|
||
@pytest.fixture | ||
def stub_tank(): | ||
tank = MotorTank( | ||
geometry=[[(0, 0), 0]], | ||
gas=TankFluids(name='gas', density=0), | ||
liquid=TankFluids(name='liquid', density=0), | ||
flux_time=(0, 0), | ||
position=0, | ||
discretize=0, | ||
name='tank', | ||
) | ||
tank_json = tank.model_dump_json() | ||
return json.loads(tank_json) | ||
|
||
|
||
@pytest.fixture | ||
def stub_level_tank(stub_tank): | ||
stub_tank.update({'tank_kind': TankKinds.LEVEL, 'liquid_height': 0}) | ||
return stub_tank | ||
GabrielBarberini marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
@pytest.fixture | ||
def stub_mass_flow_tank(stub_tank): | ||
stub_tank.update( | ||
{ | ||
'tank_kind': TankKinds.MASS_FLOW, | ||
'gas_mass_flow_rate_in': 0, | ||
'gas_mass_flow_rate_out': 0, | ||
'liquid_mass_flow_rate_in': 0, | ||
'liquid_mass_flow_rate_out': 0, | ||
'initial_liquid_mass': 0, | ||
'initial_gas_mass': 0, | ||
} | ||
) | ||
return stub_tank | ||
|
||
|
||
@pytest.fixture | ||
def stub_ullage_tank(stub_tank): | ||
stub_tank.update({'tank_kind': TankKinds.ULLAGE, 'ullage': 0}) | ||
return stub_tank | ||
|
||
|
||
@pytest.fixture | ||
def stub_mass_tank(stub_tank): | ||
stub_tank.update( | ||
{'tank_kind': TankKinds.MASS, 'liquid_mass': 0, 'gas_mass': 0} | ||
) | ||
return stub_tank | ||
|
||
|
||
@pytest.fixture | ||
def stub_rocket(stub_motor): | ||
rocket = Rocket( | ||
motor=stub_motor, | ||
radius=0, | ||
mass=0, | ||
motor_position=0, | ||
center_of_mass_without_motor=0, | ||
inertia=[0, 0, 0], | ||
power_off_drag=[(0, 0)], | ||
power_on_drag=[(0, 0)], | ||
coordinate_system_orientation='TAIL_TO_NOSE', | ||
) | ||
rocket_json = rocket.model_dump_json() | ||
return json.loads(rocket_json) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to clear some things up for me: Why the override of the equality operator? In which situations will this equality check be used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Truth be said this is actually a hack to make this pass:
But definitely should be refactored.
I'll try to think in a non-verbose yet functional way to overcome that, thanks for bringing this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
patched here 8a8e680