Skip to content
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

Add tests and docs for Payload component #278

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions docs/Components/Auxiliary/Payload.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Payload

Payload is a class created to act as a variable-mass container. Currently it is simple an AttachedComponent with the type 'payload'.

## Instantiation
To instantiate a Payload one can pass the same arguments used to instantiate an AttachedComponent:

``` python
import math
from vec import Vector2

from adr.Components.Auxiliary import Payload

main_payload = Payload(
name='main_payload',
mass=9.2,
relative_position=Vector2(-0.2, 0),
relative_angle=math.radians(0)
)

print(main_payload.type)
>>> payload
```
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ nav:
AttachedComponent: Components/AttachedComponent.md
Auxiliary:
LandingGear: Components/Auxiliary/LandingGear.md
Payload: Components/Auxiliary/Payload.md
World:
Ambient: World/Ambient.md
constants: World/constants.md
Expand Down
20 changes: 20 additions & 0 deletions tests/Components/Auxiliary/test_Payload.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import pytest
import math
from vec import Vector2

from adr.Components.Auxiliary import Payload


@pytest.fixture
def main_payload():
main_payload = Payload(
name='main_payload',
mass=9.2,
relative_position=Vector2(-0.2, 0),
relative_angle=math.radians(0)
)
return main_payload


def test_instantiation(main_payload):
assert(main_payload.type == 'payload')