diff --git a/test/general/test_implemented.py b/test/general/test_implemented.py index 67d0e5ff..b60bcee4 100644 --- a/test/general/test_implemented.py +++ b/test/general/test_implemented.py @@ -1,6 +1,8 @@ import unittest -from worlds.AutoWorld import AutoWorldRegister +from Fill import distribute_items_restrictive +from NetUtils import encode +from worlds.AutoWorld import AutoWorldRegister, call_all from . import setup_solo_multiworld @@ -31,3 +33,17 @@ class TestImplemented(unittest.TestCase): for method in ("assert_generate",): self.assertFalse(hasattr(world_type, method), f"{method} must be implemented as a @classmethod named stage_{method}.") + + def test_slot_data(self): + """Tests that if a world creates slot data, it's json serializable.""" + for game_name, world_type in AutoWorldRegister.world_types.items(): + # has an await for generate_output which isn't being called + if game_name in {"Ocarina of Time", "Zillion"}: + continue + with self.subTest(game_name): + multiworld = setup_solo_multiworld(world_type) + distribute_items_restrictive(multiworld) + call_all(multiworld, "post_fill") + for key, data in multiworld.worlds[1].fill_slot_data().items(): + self.assertIsInstance(key, str, "keys in slot data must be a string") + self.assertIsInstance(encode(data), str, f"object {type(data).__name__} not serializable.")