Implement item cachine for 26.3

This commit is contained in:
Tanner
2026-11-04 18:54:04 +00:00
parent 459e288407
commit 9fd565c3c9
10 changed files with 228 additions and 37 deletions
+31
View File
@@ -0,0 +1,31 @@
import unittest
from munch import Munch
from mosfet.info import items
from mosfet.job import JobStates
class TestCropCaching(unittest.TestCase):
def test_crop_farm_runs_silent_cache_machine_and_keeps_seeds(self):
old_wanted = items.WANTED_ITEMS
crop_state = object()
cache_state = Munch(silent=False)
jobs = JobStates.__new__(JobStates)
jobs.gather_crop_states = crop_state
jobs.cache_items_states = cache_state
try:
machines = JobStates.farm_crop(jobs)
self.assertEqual(machines, [crop_state, cache_state])
self.assertTrue(cache_state.silent)
self.assertTrue({
items.CARROT_ID, items.POTATO_ID,
items.WHEAT_SEEDS_ID, items.BEETROOT_SEEDS_ID,
}.issubset(items.WANTED_ITEMS))
finally:
items.WANTED_ITEMS = old_wanted
if __name__ == '__main__':
unittest.main()