Fix missing sapling report in tree planting
This commit is contained in:
@@ -45,8 +45,8 @@ class PlantTreeStates:
|
||||
self.state = self.cleanup
|
||||
return
|
||||
|
||||
sapling_type = items.get_name(sapling_item)
|
||||
if self.g.game.select_item([sapling_item]):
|
||||
sapling_type = items.get_name(sapling_item)
|
||||
self.g.look_at = utils.padd(p, path.BLOCK_BELOW)
|
||||
self.state = self.wait_select
|
||||
self.wait_time = 1
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import unittest
|
||||
from munch import Munch
|
||||
|
||||
from mosfet.jobs.plant_tree import PlantTreeStates
|
||||
|
||||
|
||||
class PlantTreeTests(unittest.TestCase):
|
||||
def test_missing_inventory_sapling_aborts_without_crashing(self):
|
||||
class FakeGame:
|
||||
@staticmethod
|
||||
def select_item(_item_ids):
|
||||
return False
|
||||
|
||||
state = PlantTreeStates(Munch(
|
||||
pos=(0, 64, 0), chopped_tree='oak', game=FakeGame()))
|
||||
state.select_sapling()
|
||||
self.assertIs(state.state.__func__, state.cleanup.__func__)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user