diff --git a/game/settings/__init__.py b/game/settings/__init__.py index 5fffc6d3..e202cb96 100644 --- a/game/settings/__init__.py +++ b/game/settings/__init__.py @@ -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 diff --git a/game/settings/settings.py b/game/settings/settings.py index e2c9ef01..3a9f4601 100644 --- a/game/settings/settings.py +++ b/game/settings/settings.py @@ -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" diff --git a/game/weather/conditions.py b/game/weather/conditions.py index 797ad8d5..dad1de78 100644 --- a/game/weather/conditions.py +++ b/game/weather/conditions.py @@ -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 diff --git a/tests/test_factions.py b/tests/test_factions.py index e6dd725c..ea30c871 100644 --- a/tests/test_factions.py +++ b/tests/test_factions.py @@ -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 diff --git a/tests/theater/test_controlpoint.py b/tests/theater/test_controlpoint.py index b0a960ad..84eca6a7 100644 --- a/tests/theater/test_controlpoint.py +++ b/tests/theater/test_controlpoint.py @@ -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