<commit_before>from unittest.mock import MagicMock,Mock
from mpf.tests.MpfTestCase import MpfTestCase
from mpf.core.events import event_handler
import mpf.platforms.trinamics_steprocker

class TestTrinamicsStepRocker(MpfTestCase):

    def getConfigFile(self):
        return 'trinamics_steprocker.yaml'

    def getMachinePath(self):
        return 'tests/machine_files/trinamics_steprocker/'

    def getOptions(self):
        options = super().getOptions()
        options['force_platform'] = False
        return options

    def test_rotary(self):
        stepper = self.machine.steppers.velocityStepper

        # spin clockwise, 45 degrees per second
        stepper.move_vel_mode( 45 )
        self.assertEqual( 45, stepper._cachedVelocity )
        
        # stop
        stepper.stop()
        self.assertEqual( 0, stepper._cachedVelocity )

        # spin counter clockwise
        stepper.move_vel_mode( -60 )
        self.assertEqual( -60, stepper._cachedVelocity )

        # stop
        stepper.stop()
        self.assertEqual( 0, stepper._cachedVelocity )

        # try to go too fast
        with self.assertRaises(ValueError):
            stepper.move_vel_mode( stepper.config['velocity_limit'] + 0.01 )
        
        # try a home / should be rejected
        with self.assertRaises(RuntimeError):
            stepper.home()

        # try a position move / should be rejected
        with self.assertRaises(RuntimeError):
            stepper.move_abs_pos( 42 )<commit_msg>Merging in Dev<commit_after>from unittest.mock import MagicMock,Mock
from mpf.tests.MpfTestCase import MpfTestCase
from mpf.core.events import event_handler
import mpf.platforms.trinamics_steprocker

class TestTrinamicsStepRocker(MpfTestCase):

    def getConfigFile(self):
        return 'trinamics_steprocker.yaml'

    def getMachinePath(self):
        return 'tests/machine_files/trinamics_steprocker/'

    def get_platform(self): 
        return False 

    def test_rotary(self):
        stepper = self.machine.steppers.velocityStepper

        # spin clockwise, 45 degrees per second
        stepper.move_vel_mode( 45 )
        self.assertEqual( 45, stepper._cachedVelocity )
        
        # stop
        stepper.stop()
        self.assertEqual( 0, stepper._cachedVelocity )

        # spin counter clockwise
        stepper.move_vel_mode( -60 )
        self.assertEqual( -60, stepper._cachedVelocity )

        # stop
        stepper.stop()
        self.assertEqual( 0, stepper._cachedVelocity )

        # try to go too fast
        with self.assertRaises(ValueError):
            stepper.move_vel_mode( stepper.config['velocity_limit'] + 0.01 )
        
        # try a home / should be rejected
        with self.assertRaises(RuntimeError):
            stepper.home()

        # try a position move / should be rejected
        with self.assertRaises(RuntimeError):
            stepper.move_abs_pos( 42 )
{'fraction_non_alphanumeric': 0.07921810699588477, 'fraction_numerical': 0.011659807956104253, 'mean_word_length': 2.497601918465228, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4610186', 'n_tokens_mistral': 892, 'n_tokens_neox': 830, 'n_words': 188}