Skip to content
Merged
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
3 changes: 3 additions & 0 deletions fox_goose_corn/src/model/boat.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
from typing import Optional

from typeguard import typechecked

from fox_goose_corn.src.model.cargo_item import AbstractCargoItem
from fox_goose_corn.src.model.river import RiverSide


@typechecked
class Boat:
_current_side: RiverSide = RiverSide.FARM_SIDE
_cargo_item: Optional[AbstractCargoItem] = None
Expand Down
13 changes: 7 additions & 6 deletions fox_goose_corn/tests/model/test_boat.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,13 @@ def test_boat_can_take_cargo(self, cargo_item_type):

boat.add_cargo(cargo_item)

def test_boat_can_only_take_expected_cargo_types(self):
boat = Boat()
cargo_item = Boat()

with pytest.raises(InvalidCargoItemException):
boat.add_cargo(cargo_item)
# Not needed if using typechecked
# def test_boat_can_only_take_expected_cargo_types(self):
# boat = Boat()
# cargo_item = Boat()
#
# with pytest.raises(InvalidCargoItemException):
# boat.add_cargo(cargo_item)

def test_boat_cannot_take_more_than_one_cargo_item(self):
boat = Boat()
Expand Down
Loading
Loading