mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
refactor of previous commits
refactor to enum typing and many other fixes fix tests attempt to fix some typescript more typescript fixes more typescript test fixes revert all API changes update to pydcs mypy fixes Use properties to check if player is blue/red/neutral update requirements.txt black -_- bump pydcs and fix mypy add opponent property bump pydcs
This commit is contained in:
@@ -17,6 +17,7 @@ from game.theater.controlpoint import (
|
||||
OffMapSpawn,
|
||||
Fob,
|
||||
ParkingType,
|
||||
Player,
|
||||
)
|
||||
from game.utils import Heading
|
||||
|
||||
@@ -30,8 +31,8 @@ def test_mission_types_friendly(mocker: Any) -> None:
|
||||
mocker.patch("game.theater.controlpoint.Airfield.is_friendly", return_value=True)
|
||||
airport = Airport(None, None) # type: ignore
|
||||
airport.name = "test" # required for Airfield.__init__
|
||||
airfield = Airfield(airport, theater=None, starts_blue=True) # type: ignore
|
||||
mission_types = list(airfield.mission_types(for_player=True))
|
||||
airfield = Airfield(airport, theater=None, starts_blue=Player.BLUE) # type: ignore
|
||||
mission_types = list(airfield.mission_types(for_player=Player.BLUE))
|
||||
assert len(mission_types) == 3
|
||||
assert FlightType.AEWC in mission_types
|
||||
assert FlightType.REFUELING in mission_types
|
||||
@@ -39,8 +40,8 @@ def test_mission_types_friendly(mocker: Any) -> None:
|
||||
|
||||
# Carrier
|
||||
mocker.patch("game.theater.controlpoint.Carrier.is_friendly", return_value=True)
|
||||
carrier = Carrier(name="test", at=None, theater=None, starts_blue=True) # type: ignore
|
||||
mission_types = list(carrier.mission_types(for_player=True))
|
||||
carrier = Carrier(name="test", at=None, theater=None, starts_blue=Player.BLUE) # type: ignore
|
||||
mission_types = list(carrier.mission_types(for_player=Player.BLUE))
|
||||
assert len(mission_types) == 3
|
||||
assert FlightType.AEWC in mission_types
|
||||
assert FlightType.REFUELING in mission_types
|
||||
@@ -48,8 +49,8 @@ def test_mission_types_friendly(mocker: Any) -> None:
|
||||
|
||||
# LHA
|
||||
mocker.patch("game.theater.controlpoint.Lha.is_friendly", return_value=True)
|
||||
lha = Lha(name="test", at=None, theater=None, starts_blue=True) # type: ignore
|
||||
mission_types = list(lha.mission_types(for_player=True))
|
||||
lha = Lha(name="test", at=None, theater=None, starts_blue=Player.BLUE) # type: ignore
|
||||
mission_types = list(lha.mission_types(for_player=Player.BLUE))
|
||||
assert len(mission_types) == 3
|
||||
assert FlightType.AEWC in mission_types
|
||||
assert FlightType.REFUELING in mission_types
|
||||
@@ -57,16 +58,16 @@ def test_mission_types_friendly(mocker: Any) -> None:
|
||||
|
||||
# Fob
|
||||
mocker.patch("game.theater.controlpoint.Fob.is_friendly", return_value=True)
|
||||
fob = Fob(name="test", at=None, theater=None, starts_blue=True) # type: ignore
|
||||
mission_types = list(fob.mission_types(for_player=True))
|
||||
fob = Fob(name="test", at=None, theater=None, starts_blue=Player.BLUE) # type: ignore
|
||||
mission_types = list(fob.mission_types(for_player=Player.BLUE))
|
||||
assert len(mission_types) == 2
|
||||
assert FlightType.AEWC in mission_types
|
||||
assert FlightType.BARCAP in mission_types
|
||||
|
||||
# Off map spawn
|
||||
mocker.patch("game.theater.controlpoint.OffMapSpawn.is_friendly", return_value=True)
|
||||
off_map_spawn = OffMapSpawn(name="test", position=None, theater=None, starts_blue=True) # type: ignore
|
||||
mission_types = list(off_map_spawn.mission_types(for_player=True))
|
||||
off_map_spawn = OffMapSpawn(name="test", position=None, theater=None, starts_blue=Player.BLUE) # type: ignore
|
||||
mission_types = list(off_map_spawn.mission_types(for_player=Player.BLUE))
|
||||
assert len(mission_types) == 0
|
||||
|
||||
|
||||
@@ -79,8 +80,8 @@ def test_mission_types_enemy(mocker: Any) -> None:
|
||||
mocker.patch("game.theater.controlpoint.Airfield.is_friendly", return_value=False)
|
||||
airport = Airport(None, None) # type: ignore
|
||||
airport.name = "test" # required for Airfield.__init__
|
||||
airfield = Airfield(airport, theater=None, starts_blue=True) # type: ignore
|
||||
mission_types = list(airfield.mission_types(for_player=True))
|
||||
airfield = Airfield(airport, theater=None, starts_blue=Player.BLUE) # type: ignore
|
||||
mission_types = list(airfield.mission_types(for_player=Player.BLUE))
|
||||
assert len(mission_types) == 8
|
||||
assert FlightType.OCA_AIRCRAFT in mission_types
|
||||
assert FlightType.OCA_RUNWAY in mission_types
|
||||
@@ -93,8 +94,8 @@ def test_mission_types_enemy(mocker: Any) -> None:
|
||||
|
||||
# Carrier
|
||||
mocker.patch("game.theater.controlpoint.Carrier.is_friendly", return_value=False)
|
||||
carrier = Carrier(name="test", at=None, theater=None, starts_blue=True) # type: ignore
|
||||
mission_types = list(carrier.mission_types(for_player=True))
|
||||
carrier = Carrier(name="test", at=None, theater=None, starts_blue=Player.BLUE) # type: ignore
|
||||
mission_types = list(carrier.mission_types(for_player=Player.BLUE))
|
||||
assert len(mission_types) == 5
|
||||
assert FlightType.ANTISHIP in mission_types
|
||||
assert FlightType.ESCORT in mission_types
|
||||
@@ -104,8 +105,8 @@ def test_mission_types_enemy(mocker: Any) -> None:
|
||||
|
||||
# LHA
|
||||
mocker.patch("game.theater.controlpoint.Lha.is_friendly", return_value=False)
|
||||
lha = Lha(name="test", at=None, theater=None, starts_blue=True) # type: ignore
|
||||
mission_types = list(lha.mission_types(for_player=True))
|
||||
lha = Lha(name="test", at=None, theater=None, starts_blue=Player.BLUE) # type: ignore
|
||||
mission_types = list(lha.mission_types(for_player=Player.BLUE))
|
||||
assert len(mission_types) == 5
|
||||
assert FlightType.ANTISHIP in mission_types
|
||||
assert FlightType.ESCORT in mission_types
|
||||
@@ -115,8 +116,8 @@ def test_mission_types_enemy(mocker: Any) -> None:
|
||||
|
||||
# Fob
|
||||
mocker.patch("game.theater.controlpoint.Fob.is_friendly", return_value=False)
|
||||
fob = Fob(name="test", at=None, theater=None, starts_blue=True) # type: ignore
|
||||
mission_types = list(fob.mission_types(for_player=True))
|
||||
fob = Fob(name="test", at=None, theater=None, starts_blue=Player.BLUE) # type: ignore
|
||||
mission_types = list(fob.mission_types(for_player=Player.BLUE))
|
||||
assert len(mission_types) == 6
|
||||
assert FlightType.AIR_ASSAULT in mission_types
|
||||
assert FlightType.ESCORT in mission_types
|
||||
@@ -129,8 +130,8 @@ def test_mission_types_enemy(mocker: Any) -> None:
|
||||
mocker.patch(
|
||||
"game.theater.controlpoint.OffMapSpawn.is_friendly", return_value=False
|
||||
)
|
||||
off_map_spawn = OffMapSpawn(name="test", position=None, theater=None, starts_blue=True) # type: ignore
|
||||
mission_types = list(off_map_spawn.mission_types(for_player=True))
|
||||
off_map_spawn = OffMapSpawn(name="test", position=None, theater=None, starts_blue=Player.BLUE) # type: ignore
|
||||
mission_types = list(off_map_spawn.mission_types(for_player=Player.BLUE))
|
||||
assert len(mission_types) == 0
|
||||
|
||||
|
||||
@@ -144,7 +145,7 @@ def test_control_point_parking(mocker: Any) -> None:
|
||||
airport = Airport(None, None) # type: ignore
|
||||
airport.name = "test" # required for Airfield.__init__
|
||||
point = Point(0, 0, None) # type: ignore
|
||||
control_point = Airfield(airport, theater=None, starts_blue=True) # type: ignore
|
||||
control_point = Airfield(airport, theater=None, starts_blue=Player.BLUE) # type: ignore
|
||||
parking_type_ground_start = ParkingType(
|
||||
fixed_wing=False, fixed_wing_stol=True, rotary_wing=False
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user