mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
Various Item pool fixes
* Pedestal goal always left a spare item in the pool, unless vanilla swords was also selected * extra items for the pool can now be given dynamically based on items still needed. * easy item pool + swordless gets 4 bows, not 2 (weird combo, but ok) * add some item pool unittests * add easy item pool to CLI and GUI
This commit is contained in:
47
test/items/TestDifficulty.py
Normal file
47
test/items/TestDifficulty.py
Normal file
@@ -0,0 +1,47 @@
|
||||
from ItemList import difficulties
|
||||
from test.TestBase import TestBase
|
||||
|
||||
base_items = 43
|
||||
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()
|
Reference in New Issue
Block a user