forked from ArchipelagoMW/Archipelago
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some tests for items. Adjust options for upgrades per unit
- Loading branch information
Showing
3 changed files
with
81 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,29 @@ | ||
import unittest | ||
from typing import Set, Dict, List | ||
|
||
from .test_base import Sc2TestBase | ||
from .. import mission_tables, options | ||
from .. import mission_tables, options, items | ||
|
||
|
||
class TestOptions(unittest.TestCase): | ||
def test_campaign_size_option_max_matches_number_of_missions(self): | ||
def test_campaign_size_option_max_matches_number_of_missions(self) -> None: | ||
self.assertEqual(options.MaximumCampaignSize.range_end, len(mission_tables.SC2Mission)) | ||
|
||
def test_unit_max_upgrades_matching_items(self) -> None: | ||
base_items: Set[str] = { | ||
items.get_full_item_list()[item].parent_item for item in items.get_full_item_list() | ||
if items.get_full_item_list()[item].parent_item is not None | ||
} | ||
|
||
upgrade_items: Dict[str, List[str]] = dict() | ||
for item in base_items: | ||
upgrade_items[item] = [ | ||
upgrade_item for upgrade_item in items.get_full_item_list() | ||
if items.get_full_item_list()[upgrade_item].parent_item == item | ||
] | ||
upgrade_counter: List[int] = list() | ||
for item in base_items: | ||
quantities: List[int] = [items.get_full_item_list()[upgrade_item].quantity for upgrade_item in upgrade_items[item]] | ||
upgrade_counter.append(sum(quantities)) | ||
|
||
self.assertEqual(options.MAX_UPGRADES_OPTION, max(upgrade_counter)) |