Clarify cache chest search counts
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user