Core: fix item_name_groups unfolding in item links (#3088)
This commit is contained in:
parent
fbfe82f57f
commit
580c9c3943
|
@ -1124,6 +1124,7 @@ class ItemLinks(OptionList):
|
||||||
raise Exception(f"item_link {link['name']} has {intersection} "
|
raise Exception(f"item_link {link['name']} has {intersection} "
|
||||||
f"items in both its local_items and non_local_items pool.")
|
f"items in both its local_items and non_local_items pool.")
|
||||||
link.setdefault("link_replacement", None)
|
link.setdefault("link_replacement", None)
|
||||||
|
link["item_pool"] = list(pool)
|
||||||
|
|
||||||
|
|
||||||
class Removed(FreeText):
|
class Removed(FreeText):
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
from BaseClasses import PlandoOptions
|
||||||
|
from Options import ItemLinks
|
||||||
from worlds.AutoWorld import AutoWorldRegister
|
from worlds.AutoWorld import AutoWorldRegister
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,3 +20,30 @@ class TestOptions(unittest.TestCase):
|
||||||
with self.subTest(game=gamename):
|
with self.subTest(game=gamename):
|
||||||
self.assertFalse(hasattr(world_type, "options"),
|
self.assertFalse(hasattr(world_type, "options"),
|
||||||
f"Unexpected assignment to {world_type.__name__}.options!")
|
f"Unexpected assignment to {world_type.__name__}.options!")
|
||||||
|
|
||||||
|
def test_item_links_name_groups(self):
|
||||||
|
"""Tests that item links successfully unfold item_name_groups"""
|
||||||
|
item_link_groups = [
|
||||||
|
[{
|
||||||
|
"name": "ItemLinkGroup",
|
||||||
|
"item_pool": ["Everything"],
|
||||||
|
"link_replacement": False,
|
||||||
|
"replacement_item": None,
|
||||||
|
}],
|
||||||
|
[{
|
||||||
|
"name": "ItemLinkGroup",
|
||||||
|
"item_pool": ["Hammer", "Bow"],
|
||||||
|
"link_replacement": False,
|
||||||
|
"replacement_item": None,
|
||||||
|
}]
|
||||||
|
]
|
||||||
|
# we really need some sort of test world but generic doesn't have enough items for this
|
||||||
|
world = AutoWorldRegister.world_types["A Link to the Past"]
|
||||||
|
plando_options = PlandoOptions.from_option_string("bosses")
|
||||||
|
item_links = [ItemLinks.from_any(item_link_groups[0]), ItemLinks.from_any(item_link_groups[1])]
|
||||||
|
for link in item_links:
|
||||||
|
link.verify(world, "tester", plando_options)
|
||||||
|
self.assertIn("Hammer", link.value[0]["item_pool"])
|
||||||
|
self.assertIn("Bow", link.value[0]["item_pool"])
|
||||||
|
|
||||||
|
# TODO test that the group created using these options has the items
|
||||||
|
|
Loading…
Reference in New Issue