Skip to content

Commit

Permalink
Update tests that hard-code a boolean value for enable_ball_search
Browse files Browse the repository at this point in the history
  • Loading branch information
avanwinkle committed Jun 4, 2024
1 parent dd159d9 commit 6816567
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
7 changes: 4 additions & 3 deletions mpf/tests/test_BallSearch.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from mpf.core.placeholder_manager import NativeTypeTemplate
from mpf.tests.MpfGameTestCase import MpfGameTestCase
from unittest.mock import MagicMock

Expand All @@ -16,7 +17,7 @@ def get_platform(self):
return 'smart_virtual'

def test_ball_search_does_not_start_when_disabled(self):
self.machine.playfields["playfield"].config['enable_ball_search'] = False
self.machine.playfields["playfield"].config['enable_ball_search'] = NativeTypeTemplate(False, self.machine)

self.machine.ball_controller.num_balls_known = 0
self.machine.switch_controller.process_switch("s_ball_switch1", 1)
Expand All @@ -34,14 +35,14 @@ def test_ball_search_does_not_start_when_disabled(self):
self.assertFalse(self.machine.ball_devices['playfield'].ball_search.enabled)
self.assertFalse(self.machine.ball_devices['playfield'].ball_search.started)

self.machine.playfields["playfield"].config['enable_ball_search'] = None
self.machine.playfields["playfield"].config['enable_ball_search'] = NativeTypeTemplate(None, self.machine)
self.machine.config['mpf']['default_ball_search'] = True
self.machine.ball_devices['playfield'].ball_search.enable()
self.assertTrue(self.machine.ball_devices['playfield'].ball_search.enabled)
self.machine.ball_devices['playfield'].ball_search.disable()
self.assertFalse(self.machine.ball_devices['playfield'].ball_search.enabled)

self.machine.playfields["playfield"].config['enable_ball_search'] = None
self.machine.playfields["playfield"].config['enable_ball_search'] = NativeTypeTemplate(None, self.machine)
self.machine.config['mpf']['default_ball_search'] = False
self.machine.ball_devices['playfield'].ball_search.enable()
self.assertFalse(self.machine.ball_devices['playfield'].ball_search.enabled)
Expand Down
3 changes: 2 additions & 1 deletion mpf/tests/test_DropTargets.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from mpf.core.placeholder_manager import NativeTypeTemplate
from mpf.tests.MpfFakeGameTestCase import MpfFakeGameTestCase
from unittest.mock import MagicMock, patch

Expand Down Expand Up @@ -323,7 +324,7 @@ def test_drop_target_ignore_ms(self):

def test_drop_target_ignore_ms_ball_search(self):

self.machine.playfields["playfield"].config['enable_ball_search'] = True
self.machine.playfields["playfield"].config['enable_ball_search'] = NativeTypeTemplate(True, self.machine)
self.machine.playfields["playfield"].balls += 1

self.mock_event('drop_target_center1_down')
Expand Down
3 changes: 2 additions & 1 deletion mpf/tests/test_Stepper.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from mpf.core.placeholder_manager import NativeTypeTemplate
from unittest.mock import MagicMock
from mpf.tests.MpfTestCase import MpfTestCase

Expand Down Expand Up @@ -142,7 +143,7 @@ def test_stepper_events(self):
def test_ball_search(self):
stepper = self.machine.steppers["linearAxis_stepper"]

self.machine.playfields["playfield"].config['enable_ball_search'] = True
self.machine.playfields["playfield"].config['enable_ball_search'] = NativeTypeTemplate(True, self.machine)
self.machine.playfields["playfield"].balls += 1

event_future = self.machine.events.wait_for_event("stepper_linearAxis_stepper_ready")
Expand Down

0 comments on commit 6816567

Please sign in to comment.