Clarify cache chest search counts

This commit is contained in:
Tanner
2026-11-07 20:10:09 +00:00
parent 87eb566a5e
commit be5fe260e3
2 changed files with 25 additions and 2 deletions
+22
View File
@@ -1,4 +1,6 @@
import io
import unittest
from contextlib import redirect_stdout
from munch import Munch
from minecraft.networking.types import BlockFace
@@ -8,6 +10,26 @@ from mosfet.jobs.cache_items import CacheItemsStates
class CacheItemsTests(unittest.TestCase):
def test_chest_search_log_distinguishes_labeled_and_trapped_counts(self):
class FakeWorld:
@staticmethod
def find_labeled_chests(*_args):
return [{} for _ in range(11)]
@staticmethod
def find_blocks_indexed(*_args):
return []
state = CacheItemsStates(Munch(
world=FakeWorld(), pos=(0, 64, 0)))
output = io.StringIO()
with redirect_stdout(output):
state.find_trapped_chests()
self.assertIn(
'Found 11 labeled chests; found 0 trapped chests: []',
output.getvalue())
def test_successful_labeled_transfer_skips_placing_another_cache_chest(self):
item_id = items.get_id('stone')
stack = Munch(present=True, item_id=item_id, item_count=16)