mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Fixing tests + mypy issues
This commit is contained in:
parent
cb6a7d4a92
commit
b14059e134
@ -4,4 +4,4 @@ from .boundedintoption import BoundedIntOption
|
||||
from .choicesoption import ChoicesOption
|
||||
from .minutesoption import MinutesOption
|
||||
from .optiondescription import OptionDescription
|
||||
from .settings import AutoAtoBehavior, Settings
|
||||
from .settings import AutoAtoBehavior, NightMissions, Settings
|
||||
|
||||
@ -14,7 +14,6 @@ from .minutesoption import minutes_option
|
||||
from .optiondescription import OptionDescription, SETTING_DESCRIPTION_KEY
|
||||
from .skilloption import skill_option
|
||||
from ..ato.starttype import StartType
|
||||
from ..weather.conditions import NightMissions
|
||||
|
||||
Views = ForcedOptions.Views
|
||||
|
||||
@ -27,6 +26,13 @@ class AutoAtoBehavior(Enum):
|
||||
Prefer = "Prefer player pilots"
|
||||
|
||||
|
||||
@unique
|
||||
class NightMissions(Enum):
|
||||
DayAndNight = "nightmissions_nightandday"
|
||||
OnlyDay = "nightmissions_onlyday"
|
||||
OnlyNight = "nightmissions_onlynight"
|
||||
|
||||
|
||||
DIFFICULTY_PAGE = "Difficulty"
|
||||
|
||||
AI_DIFFICULTY_SECTION = "AI Difficulty"
|
||||
|
||||
@ -4,21 +4,14 @@ import datetime
|
||||
import logging
|
||||
import random
|
||||
from dataclasses import dataclass
|
||||
from enum import Enum
|
||||
|
||||
from game.settings import Settings
|
||||
from game.theater import ConflictTheater, DaytimeMap, SeasonalConditions
|
||||
from game.settings import Settings, NightMissions
|
||||
from game.theater import ConflictTheater, SeasonalConditions
|
||||
from game.theater.seasonalconditions import determine_season
|
||||
from game.timeofday import TimeOfDay
|
||||
from game.weather.weather import Weather, Thunderstorm, Raining, Cloudy, ClearSkies
|
||||
|
||||
|
||||
class NightMissions(Enum):
|
||||
DayAndNight = "nightmissions_nightandday"
|
||||
OnlyDay = "nightmissions_onlyday"
|
||||
OnlyNight = "nightmissions_onlynight"
|
||||
|
||||
|
||||
@dataclass
|
||||
class Conditions:
|
||||
time_of_day: TimeOfDay
|
||||
|
||||
@ -46,7 +46,7 @@ class TestFactionLoader(unittest.TestCase):
|
||||
@pytest.mark.skip(reason="Faction unit names in the json files are outdated")
|
||||
def test_load_valid_faction(self) -> None:
|
||||
with (RESOURCES_DIR / "valid_faction.json").open("r") as data:
|
||||
faction = Faction.from_json(json.load(data))
|
||||
faction = Faction.from_dict(json.load(data))
|
||||
|
||||
self.assertEqual(faction.country.name, "USA")
|
||||
self.assertEqual(faction.name, "USA 2005")
|
||||
@ -108,7 +108,7 @@ class TestFactionLoader(unittest.TestCase):
|
||||
def test_load_valid_faction_with_invalid_country(self) -> None:
|
||||
with (RESOURCES_DIR / "invalid_faction_country.json").open("r") as data:
|
||||
try:
|
||||
Faction.from_json(json.load(data))
|
||||
Faction.from_dict(json.load(data))
|
||||
self.fail("Should have thrown assertion error")
|
||||
except AssertionError as e:
|
||||
pass
|
||||
|
||||
@ -6,6 +6,7 @@ from game.ato.flighttype import FlightType
|
||||
from game.theater.controlpoint import Airfield, Carrier, Lha, OffMapSpawn, Fob
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def test_mission_types_friendly(mocker: Any) -> None:
|
||||
"""
|
||||
Test the mission types that can be planned against friendly control points
|
||||
@ -54,6 +55,7 @@ def test_mission_types_friendly(mocker: Any) -> None:
|
||||
assert len(mission_types) == 0
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def test_mission_types_enemy(mocker: Any) -> None:
|
||||
"""
|
||||
Test the mission types that can be planned against enemy control points
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user