mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00

rename itemlist to itempool, as the actual item listing is in items.py change pedestal text of book of mudora from paradox to hylian for dingusses
48 lines
1.3 KiB
Python
48 lines
1.3 KiB
Python
from ItemPool import difficulties
|
|
from test.TestBase import TestBase
|
|
|
|
base_items = 41
|
|
extra_counts = (15, 15, 10, 5, 25)
|
|
|
|
|
|
class TestDifficulty(TestBase):
|
|
pass
|
|
|
|
|
|
def build_difficulty_test(difficulty):
|
|
# binds difficulty to definition local scope
|
|
def build_for(function):
|
|
def wrapped(self, *args):
|
|
return function(self, difficulty, *args)
|
|
|
|
return wrapped
|
|
|
|
return build_for
|
|
|
|
|
|
def build_dynamic_tests():
|
|
for name, difficulty in difficulties.items():
|
|
|
|
@build_difficulty_test(difficulty)
|
|
def test_dyn_difficulty(self, difficulty):
|
|
base = len(difficulty.baseitems)
|
|
self.assertEqual(base, base_items)
|
|
|
|
setattr(TestDifficulty, f"testCountBase{name}", test_dyn_difficulty)
|
|
|
|
@build_difficulty_test(difficulty)
|
|
def test_dyn_difficulty(self, difficulty):
|
|
self.assertEqual(len(extra_counts), len(difficulty.extras))
|
|
|
|
setattr(TestDifficulty, f"testCountExtra{name}", test_dyn_difficulty)
|
|
|
|
@build_difficulty_test(difficulty)
|
|
def test_dyn_difficulty(self, difficulty):
|
|
for i, extras in enumerate(extra_counts):
|
|
self.assertEqual(extras, len(difficulty.extras[i]))
|
|
|
|
setattr(TestDifficulty, f"testCountExtras{name}", test_dyn_difficulty)
|
|
|
|
|
|
build_dynamic_tests()
|