Port and tune 26.3 wood farming
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
from munch import Munch
|
||||
|
||||
from mosfet.jobs.clear_leaves import ClearLeavesStates
|
||||
|
||||
|
||||
class ClearLeavesTests(unittest.TestCase):
|
||||
def test_spaces_leaf_breaks_at_configured_interval(self):
|
||||
class FakeGame:
|
||||
def __init__(self):
|
||||
self.broken = []
|
||||
|
||||
def break_block(self, location):
|
||||
self.broken.append(location)
|
||||
return True
|
||||
|
||||
game = FakeGame()
|
||||
state = ClearLeavesStates(Munch(
|
||||
breaking=False, game=game, look_at=None))
|
||||
state.leaves = [(0, 64, 0), (1, 64, 0)]
|
||||
|
||||
with patch('mosfet.jobs.clear_leaves.time.monotonic', return_value=10):
|
||||
state.break_leaves()
|
||||
self.assertEqual(game.broken, [(0, 64, 0)])
|
||||
|
||||
with patch('mosfet.jobs.clear_leaves.time.monotonic', return_value=10.59):
|
||||
state.break_leaves()
|
||||
self.assertEqual(game.broken, [(0, 64, 0)])
|
||||
|
||||
with patch('mosfet.jobs.clear_leaves.time.monotonic', return_value=10.6):
|
||||
state.break_leaves()
|
||||
self.assertEqual(game.broken, [(0, 64, 0), (1, 64, 0)])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user