<commit_before>from mpf.tests.MpfTestCase import MpfTestCase
from unittest.mock import MagicMock


class TestCoilPlayer(MpfTestCase):

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

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

    def get_platform(self):
        return "smart_virtual"

    def test_express_config(self):
        # coil with allow_enable set
        coil = self.machine.coils['coil_1']
        coil.pulse = MagicMock()
        coil.enable = MagicMock()

        self.machine.events.post('event1')
        self.advance_time_and_run()

        coil.pulse.assert_called_with(power=1.0, priority=0)
        assert not coil.enable.called

        # coil without allow_enable
        coil = self.machine.coils['coil_2']
        coil.pulse = MagicMock()
        coil.enable = MagicMock()

        self.machine.events.post('event6')
        self.advance_time_and_run()

        coil.pulse.assert_called_with(power=1.0, priority=0)
        assert not coil.enable.called<commit_msg>test more syntax variants<commit_after>from mpf.tests.MpfTestCase import MpfTestCase
from unittest.mock import MagicMock


class TestCoilPlayer(MpfTestCase):

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

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

    def get_platform(self):
        return "smart_virtual"

    def test_express_config(self):
        # coil with allow_enable set
        coil = self.machine.coils['coil_1']
        coil.pulse = MagicMock()
        coil.enable = MagicMock()

        self.machine.events.post('event1')
        self.advance_time_and_run()

        coil.pulse.assert_called_with(power=1.0, priority=0)
        assert not coil.enable.called

        # coil without allow_enable
        coil = self.machine.coils['coil_2']
        coil.pulse = MagicMock()
        coil.enable = MagicMock()

        self.machine.events.post('event6')
        self.advance_time_and_run()

        coil.pulse.assert_called_with(power=1.0, priority=0)
        assert not coil.enable.called

        coil = self.machine.coils['coil_3']
        coil.pulse = MagicMock()
        coil.enable = MagicMock()
        coil.disable = MagicMock()

        self.post_event("event7")
        self.advance_time_and_run()
        coil.enable.assert_called_with(power=1.0, priority=0)
        assert not coil.disable.called
        assert not coil.pulse.called
        coil.pulse = MagicMock()
        coil.enable = MagicMock()
        coil.disable = MagicMock()

        self.post_event("event8")
        self.advance_time_and_run()
        coil.disable.assert_called_with(power=1.0, priority=0)
        assert not coil.enable.called
        assert not coil.pulse.called
        coil.pulse = MagicMock()
        coil.enable = MagicMock()
        coil.disable = MagicMock()

        self.post_event("event9")
        self.advance_time_and_run()
        coil.pulse.assert_called_with(milliseconds=30, power=1.0, priority=0)
        assert not coil.disable.called
        assert not coil.enable.called
{'fraction_non_alphanumeric': 0.10061468780329991, 'fraction_numerical': 0.011323196376577159, 'mean_word_length': 2.59953434225844, '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': '7561335', 'n_tokens_mistral': 1007, 'n_tokens_neox': 952, 'n_words': 167}