From 2069c94a109583e1b0ec1f94a70f2661e11d5ba6 Mon Sep 17 00:00:00 2001 From: Ken Roberts Date: Wed, 15 May 2019 06:23:58 -0700 Subject: [PATCH] Remove extraneous parens --- .../projectors/test_projector_commands_01.py | 44 ++++----- .../projectors/test_projector_commands_02.py | 64 ++++++------ .../projectors/test_projector_commands_03.py | 16 +-- .../test_projector_pjlink_base_02.py | 98 +++++++++---------- 4 files changed, 111 insertions(+), 111 deletions(-) diff --git a/tests/openlp_core/projectors/test_projector_commands_01.py b/tests/openlp_core/projectors/test_projector_commands_01.py index 207ab92f9..deaba7619 100644 --- a/tests/openlp_core/projectors/test_projector_commands_01.py +++ b/tests/openlp_core/projectors/test_projector_commands_01.py @@ -92,7 +92,7 @@ class TestPJLinkCommands(TestCase): # THEN: Shutter should be closed and mute should be True assert self.pjlink.shutter, 'Shutter should changed' assert self.pjlink.mute, 'Audio should not have changed' - assert (not mock_UpdateIcons.emit.called), 'Update icons should NOT have been called' + assert not mock_UpdateIcons.emit.called, 'Update icons should NOT have been called' mock_log.warning.assert_has_calls(log_warning_text) mock_log.debug.assert_has_calls(log_debug_text) @@ -140,8 +140,8 @@ class TestPJLinkCommands(TestCase): process_command(projector=self.pjlink, cmd='AVMT', data='30') # THEN: Shutter should be closed and mute should be True - assert (not self.pjlink.shutter), 'Shutter should have been set to off' - assert (not self.pjlink.mute), 'Audio should be on' + assert not self.pjlink.shutter, 'Shutter should have been set to off' + assert not self.pjlink.mute, 'Audio should be on' assert mock_UpdateIcons.emit.called, 'Update icons should have been called' mock_log.warning.assert_has_calls(log_warning_text) mock_log.debug.assert_has_calls(log_debug_text) @@ -193,7 +193,7 @@ class TestPJLinkCommands(TestCase): assert self.pjlink.shutter, 'Shutter should have been set to closed' assert self.pjlink.mute, 'Audio should not have changed' assert mock_UpdateIcons.emit.called, 'Update icons should have been called' - assert ('AVMT' not in self.pjlink.status_timer_checks), 'Status timer list should not have AVMT callback' + assert 'AVMT' not in self.pjlink.status_timer_checks, 'Status timer list should not have AVMT callback' assert mock_status_timer.stop.called, 'Projector status_timer.stop() should have been called' mock_log.warning.assert_has_calls(log_warning_text) mock_log.debug.assert_has_calls(log_debug_text) @@ -214,7 +214,7 @@ class TestPJLinkCommands(TestCase): process_command(projector=self.pjlink, cmd='CLSS', data='1') # THEN: Projector class should be set with proper value - assert ('1' == self.pjlink.pjlink_class), 'Should have set class=1' + assert '1' == self.pjlink.pjlink_class, 'Should have set class=1' mock_log.error.assert_has_calls(log_error_calls) mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) @@ -235,7 +235,7 @@ class TestPJLinkCommands(TestCase): process_command(projector=self.pjlink, cmd='CLSS', data='2') # THEN: Projector class should be set with proper value - assert ('2' == self.pjlink.pjlink_class), 'Should have set class=2' + assert '2' == self.pjlink.pjlink_class, 'Should have set class=2' mock_log.error.assert_has_calls(log_error_calls) mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) @@ -256,7 +256,7 @@ class TestPJLinkCommands(TestCase): process_command(projector=self.pjlink, cmd='CLSS', data='Z') # THEN: Projector class should be set with default value - assert (self.pjlink.pjlink_class == '1'), 'Invalid NaN class reply should have set class=1' + assert self.pjlink.pjlink_class == '1', 'Invalid NaN class reply should have set class=1' mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) @@ -276,7 +276,7 @@ class TestPJLinkCommands(TestCase): process_command(projector=self.pjlink, cmd='CLSS', data='Invalid') # THEN: Projector class should be set with default value - assert (self.pjlink.pjlink_class == '1'), 'Invalid class reply should have set class=1' + assert self.pjlink.pjlink_class == '1', 'Invalid class reply should have set class=1' mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) @@ -296,7 +296,7 @@ class TestPJLinkCommands(TestCase): process_command(projector=self.pjlink, cmd='CLSS', data='Class 1') # THEN: Projector class should be set with proper value - assert ('1' == self.pjlink.pjlink_class), 'Non-standard class reply should have set class=1' + assert '1' == self.pjlink.pjlink_class, 'Non-standard class reply should have set class=1' mock_log.error.assert_has_calls(log_error_calls) mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) @@ -316,7 +316,7 @@ class TestPJLinkCommands(TestCase): process_command(projector=self.pjlink, cmd='CLSS', data='Version2') # THEN: Projector class should be set with proper value - assert ('2' == self.pjlink.pjlink_class), 'Non-standard class reply should have set class=1' + assert '2' == self.pjlink.pjlink_class, 'Non-standard class reply should have set class=1' mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) @@ -348,7 +348,7 @@ class TestPJLinkCommands(TestCase): process_command(projector=self.pjlink, cmd='ERST', data=chk_data) # THEN: PJLink instance errors should match chk_value - assert (self.pjlink.projector_errors == chk_test), 'Projector errors should be all E_ERROR' + assert self.pjlink.projector_errors == chk_test, 'Projector errors should be all E_ERROR' mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) @@ -368,7 +368,7 @@ class TestPJLinkCommands(TestCase): process_command(projector=self.pjlink, cmd='ERST', data=chk_data) # THEN: PJLink instance errors should be None - assert (self.pjlink.projector_errors is None), 'projector_errors should have been set to None' + assert self.pjlink.projector_errors is None, 'projector_errors should have been set to None' mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) @@ -400,7 +400,7 @@ class TestPJLinkCommands(TestCase): process_command(projector=self.pjlink, cmd='ERST', data=chk_data) # THEN: PJLink instance errors should match chk_value - assert (self.pjlink.projector_errors == chk_test), 'Projector errors should be all E_WARN' + assert self.pjlink.projector_errors == chk_test, 'Projector errors should be all E_WARN' mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) @@ -423,7 +423,7 @@ class TestPJLinkCommands(TestCase): process_command(self.pjlink, cmd='ERST', data=chk_data) # THEN: pjlink.projector_errors should be empty and warning logged - assert (not self.pjlink.projector_errors), 'There should be no errors' + assert not self.pjlink.projector_errors, 'There should be no errors' mock_log.warning.assert_has_calls(log_warn_calls) mock_log.debug.assert_has_calls(log_debug_calls) @@ -445,7 +445,7 @@ class TestPJLinkCommands(TestCase): process_command(self.pjlink, cmd='ERST', data=chk_data) # THEN: pjlink.projector_errors should be empty and warning logged - assert (not self.pjlink.projector_errors), 'There should be no errors' + assert not self.pjlink.projector_errors, 'There should be no errors' mock_log.warning.assert_has_calls(log_warn_calls) mock_log.debug.assert_has_calls(log_debug_calls) @@ -472,10 +472,10 @@ class TestPJLinkCommands(TestCase): process_command(projector=self.pjlink, cmd='ERST', data=chk_data) # THEN: PJLink instance errors should match only cover warning - assert (1 == len(self.pjlink.projector_errors)), 'There should only be 1 error listed in projector_errors' - assert ('Cover' in self.pjlink.projector_errors), '"Cover" should be the only error listed' - assert (self.pjlink.projector_errors['Cover'] == E_WARN), '"Cover" should have E_WARN listed as error' - assert (chk_test == self.pjlink.projector_errors), 'projector_errors should match test errors' + assert 1 == len(self.pjlink.projector_errors), 'There should only be 1 error listed in projector_errors' + assert 'Cover' in self.pjlink.projector_errors, '"Cover" should be the only error listed' + assert self.pjlink.projector_errors['Cover'] == E_WARN, '"Cover" should have E_WARN listed as error' + assert chk_test == self.pjlink.projector_errors, 'projector_errors should match test errors' mock_log.warning.assert_has_calls(log_warn_calls) mock_log.debug.assert_has_calls(log_debug_calls) @@ -498,7 +498,7 @@ class TestPJLinkCommands(TestCase): process_command(projector=self.pjlink, cmd='INF1', data=chk_data) # THEN: Data should be saved - assert (self.pjlink.manufacturer == chk_data), 'Test data should have been saved' + assert self.pjlink.manufacturer == chk_data, 'Test data should have been saved' mock_log.warning.assert_has_calls(log_warn_calls) mock_log.debug.assert_has_calls(log_debug_calls) @@ -521,7 +521,7 @@ class TestPJLinkCommands(TestCase): process_command(projector=self.pjlink, cmd='INF2', data=chk_data) # THEN: Data should be saved - assert (self.pjlink.model == chk_data), 'Test data should have been saved' + assert self.pjlink.model == chk_data, 'Test data should have been saved' mock_log.warning.assert_has_calls(log_warn_calls) mock_log.debug.assert_has_calls(log_debug_calls) @@ -544,6 +544,6 @@ class TestPJLinkCommands(TestCase): process_command(projector=self.pjlink, cmd='INFO', data=chk_data) # THEN: Data should be saved - assert (self.pjlink.other_info == chk_data), 'Test data should have been saved' + assert self.pjlink.other_info == chk_data, 'Test data should have been saved' mock_log.warning.assert_has_calls(log_warn_calls) mock_log.debug.assert_has_calls(log_debug_calls) diff --git a/tests/openlp_core/projectors/test_projector_commands_02.py b/tests/openlp_core/projectors/test_projector_commands_02.py index 54306c0fe..2462010cc 100644 --- a/tests/openlp_core/projectors/test_projector_commands_02.py +++ b/tests/openlp_core/projectors/test_projector_commands_02.py @@ -67,7 +67,7 @@ class TestPJLinkCommands(TestCase): process_command(projector=self.pjlink, cmd='INPT', data='21') # THEN: Input selected should reflect current input - assert ('21' == self.pjlink.source), 'Input source should be set to "21"' + assert '21' == self.pjlink.source, 'Input source should be set to "21"' mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) @@ -88,7 +88,7 @@ class TestPJLinkCommands(TestCase): process_command(projector=self.pjlink, cmd='INPT', data='91') # THEN: Input selected should reflect current input - assert (not self.pjlink.source), 'Input source should not have changed' + assert not self.pjlink.source, 'Input source should not have changed' mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) @@ -110,7 +110,7 @@ class TestPJLinkCommands(TestCase): process_command(projector=self.pjlink, cmd='INPT', data='25') # THEN: Input selected should reflect current input - assert ('11' == self.pjlink.source), 'Input source should not have changed' + assert '11' == self.pjlink.source, 'Input source should not have changed' mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) @@ -138,7 +138,7 @@ class TestPJLinkCommands(TestCase): # THEN: Data should have been sorted and saved properly mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) - assert (self.pjlink.source_available == chk_test), "Sources should have been sorted and saved" + assert self.pjlink.source_available == chk_test, "Sources should have been sorted and saved" @patch.object(openlp.core.projectors.pjlinkcommands, 'log') def test_projector_lamp_invalid_missing_data(self, mock_log): @@ -158,7 +158,7 @@ class TestPJLinkCommands(TestCase): # THEN: Lamp should have been set with proper lamp status mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) - assert (not self.pjlink.lamp), 'Projector lamp info should not have changed' + assert not self.pjlink.lamp, 'Projector lamp info should not have changed' @patch.object(openlp.core.projectors.pjlinkcommands, 'log') def test_projector_lamp_invalid_nan(self, mock_log): @@ -180,11 +180,11 @@ class TestPJLinkCommands(TestCase): # THEN: lamps should not have changed mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) - assert (2 == len(self.pjlink.lamp)), 'Projector lamp list should not have changed' + assert 2 == len(self.pjlink.lamp), 'Projector lamp list should not have changed' assert self.pjlink.lamp[0]['On'], 'Lamp 1 power status should not have changed' - assert (0 == self.pjlink.lamp[0]['Hours']), 'Lamp 1 hours should not have changed' - assert (not self.pjlink.lamp[1]['On']), 'Lamp 2 power status should not have changed' - assert (11111 == self.pjlink.lamp[1]['Hours']), 'Lamp 2 hours should not have changed' + assert 0 == self.pjlink.lamp[0]['Hours'], 'Lamp 1 hours should not have changed' + assert not self.pjlink.lamp[1]['On'], 'Lamp 2 power status should not have changed' + assert 11111 == self.pjlink.lamp[1]['Hours'], 'Lamp 2 hours should not have changed' @patch.object(openlp.core.projectors.pjlinkcommands, 'log') def test_projector_lamp_multiple(self, mock_log): @@ -204,13 +204,13 @@ class TestPJLinkCommands(TestCase): # THEN: Lamp should have been set with proper lamp status mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) - assert (3 == len(self.pjlink.lamp)), 'Projector should have 3 lamps specified' + assert 3 == len(self.pjlink.lamp), 'Projector should have 3 lamps specified' assert self.pjlink.lamp[0]['On'], 'Lamp 1 power status should have been set to TRUE' - assert (11111 == self.pjlink.lamp[0]['Hours']), 'Lamp 1 hours should have been set to 11111' - assert (not self.pjlink.lamp[1]['On']), 'Lamp 2 power status should have been set to FALSE' - assert (22222 == self.pjlink.lamp[1]['Hours']), 'Lamp 2 hours should have been set to 22222' + assert 11111 == self.pjlink.lamp[0]['Hours'], 'Lamp 1 hours should have been set to 11111' + assert not self.pjlink.lamp[1]['On'], 'Lamp 2 power status should have been set to FALSE' + assert 22222 == self.pjlink.lamp[1]['Hours'], 'Lamp 2 hours should have been set to 22222' assert self.pjlink.lamp[2]['On'], 'Lamp 3 power status should have been set to TRUE' - assert (33333 == self.pjlink.lamp[2]['Hours']), 'Lamp 3 hours should have been set to 33333' + assert 33333 == self.pjlink.lamp[2]['Hours'], 'Lamp 3 hours should have been set to 33333' @patch.object(openlp.core.projectors.pjlinkcommands, 'log') def test_projector_lamp_single(self, mock_log): @@ -229,9 +229,9 @@ class TestPJLinkCommands(TestCase): # THEN: Lamp should have been set with proper lamp status mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) - assert (1 == len(self.pjlink.lamp)), 'Projector should have 1 lamp specified' + assert 1 == len(self.pjlink.lamp), 'Projector should have 1 lamp specified' assert self.pjlink.lamp[0]['On'], 'Lamp 1 power status should have been set to TRUE' - assert (11111 == self.pjlink.lamp[0]['Hours']), 'Lamp 1 hours should have been set to 11111' + assert 11111 == self.pjlink.lamp[0]['Hours'], 'Lamp 1 hours should have been set to 11111' @patch.object(openlp.core.projectors.pjlinkcommands, 'log') def test_projector_name(self, mock_log): @@ -253,7 +253,7 @@ class TestPJLinkCommands(TestCase): # THEN: name should be set and logged mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) - assert (self.pjlink.pjlink_name == chk_data), 'Name test data should have been saved' + assert self.pjlink.pjlink_name == chk_data, 'Name test data should have been saved' @patch.object(openlp.core.projectors.pjlink.PJLink, 'send_command') @patch.object(openlp.core.projectors.pjlink.PJLink, 'change_status') @@ -276,7 +276,7 @@ class TestPJLinkCommands(TestCase): # THEN: Projector power should not have changed mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) - assert (S_STANDBY == self.pjlink.power), 'Power should not have changed' + assert S_STANDBY == self.pjlink.power, 'Power should not have changed' mock_UpdateIcons.emit.assert_not_called() mock_change_status.assert_not_called() mock_send_command.assert_not_called() @@ -302,9 +302,9 @@ class TestPJLinkCommands(TestCase): # THEN: Power should be set to ON mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) - assert (S_STANDBY == self.pjlink.power), 'Power should have been set to OFF' + assert S_STANDBY == self.pjlink.power, 'Power should have been set to OFF' assert mock_UpdateIcons.emit.called, 'projectorUpdateIcons should have been called' - assert (not mock_send_command.called), 'send_command should not have been called' + assert not mock_send_command.called, 'send_command should not have been called' mock_change_status.assert_called_once_with(S_STANDBY) @patch.object(openlp.core.projectors.pjlink.PJLink, 'send_command') @@ -328,7 +328,7 @@ class TestPJLinkCommands(TestCase): # THEN: Power should be set to ON mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) - assert (S_ON == self.pjlink.power), 'Power should have been set to ON' + assert S_ON == self.pjlink.power, 'Power should have been set to ON' assert mock_UpdateIcons.emit.called, 'projectorUpdateIcons should have been called' mock_send_command.assert_called_once_with('INST') mock_change_status.assert_called_once_with(S_ON) @@ -352,7 +352,7 @@ class TestPJLinkCommands(TestCase): # THEN: Filter model number should be saved mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) - assert (self.pjlink.model_filter == new_data), 'Filter model should have been saved' + assert self.pjlink.model_filter == new_data, 'Filter model should have been saved' @patch.object(openlp.core.projectors.pjlinkcommands, 'log') def test_projector_rfil_nosave(self, mock_log): @@ -374,7 +374,7 @@ class TestPJLinkCommands(TestCase): process_command(projector=self.pjlink, cmd='RFIL', data=new_data) # THEN: Filter model number should be saved - assert (self.pjlink.model_filter != new_data), 'Filter model should NOT have been saved' + assert self.pjlink.model_filter != new_data, 'Filter model should NOT have been saved' mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) @@ -397,7 +397,7 @@ class TestPJLinkCommands(TestCase): # THEN: Filter model number should be saved mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) - assert (self.pjlink.model_lamp == new_data), 'Lamp model should have been saved' + assert self.pjlink.model_lamp == new_data, 'Lamp model should have been saved' @patch.object(openlp.core.projectors.pjlinkcommands, 'log') def test_projector_rlmp_nosave(self, mock_log): @@ -419,7 +419,7 @@ class TestPJLinkCommands(TestCase): process_command(projector=self.pjlink, cmd='RLMP', data=new_data) # THEN: Filter model number should be saved - assert (self.pjlink.model_lamp != new_data), 'Lamp model should NOT have been saved' + assert self.pjlink.model_lamp != new_data, 'Lamp model should NOT have been saved' mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) @@ -446,7 +446,7 @@ class TestPJLinkCommands(TestCase): process_command(projector=self.pjlink, cmd='SNUM', data=new_data) # THEN: Serial number should be set - assert (self.pjlink.serial_no != new_data), 'Projector serial number should NOT have been set' + assert self.pjlink.serial_no != new_data, 'Projector serial number should NOT have been set' mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) @@ -469,7 +469,7 @@ class TestPJLinkCommands(TestCase): process_command(projector=self.pjlink, cmd='SNUM', data=new_data) # THEN: Serial number should be set - assert (self.pjlink.serial_no == new_data), 'Projector serial number should have been set' + assert self.pjlink.serial_no == new_data, 'Projector serial number should have been set' mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) @@ -497,7 +497,7 @@ class TestPJLinkCommands(TestCase): process_command(self.pjlink, cmd='SVER', data=new_data) # THEN: Version information should change - assert (self.pjlink.sw_version == new_data), 'Software version should have changed' + assert self.pjlink.sw_version == new_data, 'Software version should have changed' mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) @@ -519,8 +519,8 @@ class TestPJLinkCommands(TestCase): process_command(projector=self.pjlink, cmd='SVER', data=new_data) # THEN: Version information should not change - assert (not self.pjlink.sw_version), 'Software version should not have changed' - assert (not self.pjlink.sw_version_received), 'Received software version should not have changed' + assert not self.pjlink.sw_version, 'Software version should not have changed' + assert not self.pjlink.sw_version_received, 'Received software version should not have changed' mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) @@ -544,7 +544,7 @@ class TestPJLinkCommands(TestCase): process_command(projector=self.pjlink, cmd='SVER', data=new_data) # THEN: Version information should not change - assert (self.pjlink.sw_version == new_data), 'Software version should have been updated' - assert (not self.pjlink.sw_version_received), 'Received version field should not have changed' + assert self.pjlink.sw_version == new_data, 'Software version should have been updated' + assert not self.pjlink.sw_version_received, 'Received version field should not have changed' mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) diff --git a/tests/openlp_core/projectors/test_projector_commands_03.py b/tests/openlp_core/projectors/test_projector_commands_03.py index b782d205e..788ac1430 100644 --- a/tests/openlp_core/projectors/test_projector_commands_03.py +++ b/tests/openlp_core/projectors/test_projector_commands_03.py @@ -74,7 +74,7 @@ class TestPJLinkCommands(TestCase): mock_log.error.assert_has_calls(log_error_calls) mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) - assert (chk == S_AUTHENTICATE), 'Should have returned {data}'.format(data=STATUS_CODE[S_AUTHENTICATE]) + assert chk == S_AUTHENTICATE, 'Should have returned {data}'.format(data=STATUS_CODE[S_AUTHENTICATE]) @patch.object(openlp.core.projectors.pjlinkcommands, 'log') def test_process_pjlink_authenticate_pin_not_set_error(self, mock_log): @@ -98,7 +98,7 @@ class TestPJLinkCommands(TestCase): mock_log.error.assert_has_calls(log_error_calls) mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) - assert (chk == E_NO_AUTHENTICATION), \ + assert chk == E_NO_AUTHENTICATION, \ 'Should have returned {data}'.format(data=STATUS_CODE[E_NO_AUTHENTICATION]) @patch.object(openlp.core.projectors.pjlinkcommands, 'log') @@ -124,7 +124,7 @@ class TestPJLinkCommands(TestCase): mock_log.error.assert_has_calls(log_error_calls) mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) - assert (chk == E_NO_AUTHENTICATION), \ + assert chk == E_NO_AUTHENTICATION, \ 'Should have returned {data}'.format(data=STATUS_CODE[E_NO_AUTHENTICATION]) @patch.object(openlp.core.projectors.pjlinkcommands, 'log') @@ -150,7 +150,7 @@ class TestPJLinkCommands(TestCase): mock_log.error.assert_has_calls(log_error_calls) mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) - assert (chk == E_NO_AUTHENTICATION), \ + assert chk == E_NO_AUTHENTICATION, \ 'Should have returned {data}'.format(data=STATUS_CODE[E_NO_AUTHENTICATION]) @patch.object(openlp.core.projectors.pjlinkcommands, 'log') @@ -175,7 +175,7 @@ class TestPJLinkCommands(TestCase): mock_log.error.assert_has_calls(log_error_calls) mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) - assert (chk == E_NO_AUTHENTICATION), \ + assert chk == E_NO_AUTHENTICATION, \ 'Should have returned {data}'.format(data=STATUS_CODE[E_NO_AUTHENTICATION]) @patch.object(openlp.core.projectors.pjlinkcommands, 'log') @@ -201,7 +201,7 @@ class TestPJLinkCommands(TestCase): mock_log.error.assert_has_calls(log_error_calls) mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) - assert (chk == S_CONNECT), 'Should have returned {data}'.format(data=STATUS_CODE[S_CONNECT]) + assert chk == S_CONNECT, 'Should have returned {data}'.format(data=STATUS_CODE[S_CONNECT]) @patch.object(openlp.core.projectors.pjlinkcommands, 'log') def test_process_pjlink_normal_pin_set_error(self, mock_log): @@ -224,7 +224,7 @@ class TestPJLinkCommands(TestCase): mock_log.error.assert_has_calls(log_error_calls) mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) - assert (chk == E_NO_AUTHENTICATION), \ + assert chk == E_NO_AUTHENTICATION, \ 'Should have returned {data}'.format(data=STATUS_CODE[E_NO_AUTHENTICATION]) @patch.object(openlp.core.projectors.pjlinkcommands, 'log') @@ -249,5 +249,5 @@ class TestPJLinkCommands(TestCase): mock_log.error.assert_has_calls(log_error_calls) mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) - assert (chk == E_NO_AUTHENTICATION), \ + assert chk == E_NO_AUTHENTICATION, \ 'Should have returned {data}'.format(data=STATUS_CODE[E_NO_AUTHENTICATION]) diff --git a/tests/openlp_core/projectors/test_projector_pjlink_base_02.py b/tests/openlp_core/projectors/test_projector_pjlink_base_02.py index 86a4fd400..2f36814f7 100644 --- a/tests/openlp_core/projectors/test_projector_pjlink_base_02.py +++ b/tests/openlp_core/projectors/test_projector_pjlink_base_02.py @@ -96,10 +96,10 @@ class TestPJLinkBase(TestCase): mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) mock_change_status.called_with(E_NETWORK, 'Error while sending data to projector') - assert (not self.pjlink.send_queue), 'Send queue should be empty' - assert (not self.pjlink.priority_queue), 'Priority queue should be empty' + assert not self.pjlink.send_queue, 'Send queue should be empty' + assert not self.pjlink.priority_queue, 'Priority queue should be empty' assert mock_timer.start.called, 'Timer should have been called' - assert (not mock_reset.called), 'reset_information() should not should have been called' + assert not mock_reset.called, 'reset_information() should not should have been called' assert mock_disconnect.called, 'disconnect_from_host() should have been called' assert self.pjlink.send_busy, 'send_busy should be True' @@ -127,10 +127,10 @@ class TestPJLinkBase(TestCase): mock_log.error.assert_has_calls(log_error_calls) mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) - assert (not self.pjlink.send_queue), 'Send queue should be empty' - assert (not self.pjlink.priority_queue), 'Priority queue should be empty' - assert (not mock_timer.called), 'Timer should not have been called' - assert (not mock_reset.called), 'reset_information() should not have been called' + assert not self.pjlink.send_queue, 'Send queue should be empty' + assert not self.pjlink.priority_queue, 'Priority queue should be empty' + assert not mock_timer.called, 'Timer should not have been called' + assert not mock_reset.called, 'reset_information() should not have been called' @patch.object(openlp.core.projectors.pjlink.PJLink, 'write') @patch.object(openlp.core.projectors.pjlink.PJLink, 'disconnect_from_host') @@ -173,11 +173,11 @@ class TestPJLinkBase(TestCase): mock_log.error.assert_has_calls(log_error_calls) mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) - assert (not self.pjlink.send_queue), 'Send queue should be empty' - assert (not self.pjlink.priority_queue), 'Priority queue should be empty' + assert not self.pjlink.send_queue, 'Send queue should be empty' + assert not self.pjlink.priority_queue, 'Priority queue should be empty' assert mock_timer.start.called, 'Timer should have been called' - assert (not mock_reset.called), 'reset_information() should not have been called' - assert (not mock_disconnect.called), 'disconnect_from_host() should not have been called' + assert not mock_reset.called, 'reset_information() should not have been called' + assert not mock_disconnect.called, 'disconnect_from_host() should not have been called' assert self.pjlink.send_busy, 'send_busy flag should be True' @patch.object(openlp.core.projectors.pjlink.PJLink, 'disconnect_from_host') @@ -211,12 +211,12 @@ class TestPJLinkBase(TestCase): mock_log.error.assert_has_calls(log_error_calls) mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) - assert (self.pjlink.send_queue == [test_command]), 'Send queue should have one entry' - assert (not self.pjlink.priority_queue), 'Priority queue should be empty' - assert (not mock_timer.called), 'Timer should not have been called' - assert (not mock_reset.called), 'reset_information() should not have been called' + assert self.pjlink.send_queue == [test_command], 'Send queue should have one entry' + assert not self.pjlink.priority_queue, 'Priority queue should be empty' + assert not mock_timer.called, 'Timer should not have been called' + assert not mock_reset.called, 'reset_information() should not have been called' assert mock_disconnect.called, 'disconnect_from_host() should have been called' - assert (not self.pjlink.send_busy), 'send_busy flag should be False' + assert not self.pjlink.send_busy, 'send_busy flag should be False' @patch.object(openlp.core.projectors.pjlink.PJLink, 'write') @patch.object(openlp.core.projectors.pjlink.PJLink, 'disconnect_from_host') @@ -261,11 +261,11 @@ class TestPJLinkBase(TestCase): mock_log.error.assert_has_calls(log_error_calls) mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) - assert (not self.pjlink.send_queue), 'Send queue should be empty' - assert (not self.pjlink.priority_queue), 'Priority queue should be empty' + assert not self.pjlink.send_queue, 'Send queue should be empty' + assert not self.pjlink.priority_queue, 'Priority queue should be empty' assert mock_timer.start.called, 'Timer should have been called' - assert (not mock_reset.called), 'reset_information() should not have been called' - assert (not mock_disconnect.called), 'disconnect_from_host() should not have been called' + assert not mock_reset.called, 'reset_information() should not have been called' + assert not mock_disconnect.called, 'disconnect_from_host() should not have been called' assert self.pjlink.send_busy, 'send_busy flag should be True' @patch.object(openlp.core.projectors.pjlink.PJLink, 'write') @@ -314,10 +314,10 @@ class TestPJLinkBase(TestCase): mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) assert self.pjlink.send_queue, 'Send queue should have one entry' - assert (not self.pjlink.priority_queue), 'Priority queue should be empty' + assert not self.pjlink.priority_queue, 'Priority queue should be empty' assert mock_timer.start.called, 'Timer should have been called' - assert (not mock_reset.called), 'reset_information() should not have been called' - assert (not mock_disconnect.called), 'disconnect_from_host() should not have been called' + assert not mock_reset.called, 'reset_information() should not have been called' + assert not mock_disconnect.called, 'disconnect_from_host() should not have been called' assert self.pjlink.send_busy, 'send_busy flag should be True' @patch.object(openlp.core.projectors.pjlink.PJLink, 'state') @@ -358,9 +358,9 @@ class TestPJLinkBase(TestCase): mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) assert self.pjlink.send_queue, 'Send queue should have one entry' - assert (not self.pjlink.priority_queue), 'Priority queue should be empty' - assert (not mock_timer.start.called), 'Timer should not have been called' - assert (not mock_reset.called), 'reset_information() should not have been called' + assert not self.pjlink.priority_queue, 'Priority queue should be empty' + assert not mock_timer.start.called, 'Timer should not have been called' + assert not mock_reset.called, 'reset_information() should not have been called' assert self.pjlink.send_busy, 'send_busy flag should be True' @patch.object(openlp.core.projectors.pjlink.PJLink, 'state') @@ -402,10 +402,10 @@ class TestPJLinkBase(TestCase): mock_log.error.assert_has_calls(log_error_calls) mock_log.warning.assert_has_calls(log_warning_calls) mock_log.debug.assert_has_calls(log_debug_calls) - assert (not self.pjlink.send_queue), 'Send queue should be empty' + assert not self.pjlink.send_queue, 'Send queue should be empty' assert self.pjlink.priority_queue, 'Priority queue should have one entry' - assert (not mock_timer.start.called), 'Timer should not have been called' - assert (not mock_reset.called), 'reset_information() should not have been called' + assert not mock_timer.start.called, 'Timer should not have been called' + assert not mock_reset.called, 'reset_information() should not have been called' assert self.pjlink.send_busy, 'send_busy flag should be True' # ------------ Test PJLink.send_command ---------- @@ -440,7 +440,7 @@ class TestPJLinkBase(TestCase): mock_log.debug.assert_has_calls(log_debug_calls) mock_log.warning.assert_has_calls(log_warning_calls) mock_log.error.assert_has_calls(log_error_calls) - assert (not mock_reset.called), 'reset_information() should not have been called' + assert not mock_reset.called, 'reset_information() should not have been called' assert mock_send_command.called, '_underscore_send_command() should have been called' @patch.object(openlp.core.projectors.pjlink.PJLink, 'state') @@ -473,8 +473,8 @@ class TestPJLinkBase(TestCase): mock_log.warning.assert_has_calls(log_warning_calls) mock_log.error.assert_has_calls(log_error_calls) mock_priority.append.assert_called_with(test_command) - assert (not mock_send.append.called), 'send_queue should not have changed' - assert (not mock_reset.called), 'reset_information() should not have been called' + assert not mock_send.append.called, 'send_queue should not have changed' + assert not mock_reset.called, 'reset_information() should not have been called' assert mock_send_command.called, '_underscore_send_command() should have been called' @patch.object(openlp.core.projectors.pjlink.PJLink, 'state') @@ -506,9 +506,9 @@ class TestPJLinkBase(TestCase): mock_log.debug.assert_has_calls(log_debug_calls) mock_log.warning.assert_has_calls(log_warning_calls) mock_log.error.assert_has_calls(log_error_calls) - assert (self.pjlink.send_queue == [test_command]), 'Send queue should have one entry' - assert (not self.pjlink.priority_queue), 'Priority queue should be empty' - assert (not mock_reset.called), 'reset_information() should not have been called' + assert self.pjlink.send_queue == [test_command], 'Send queue should have one entry' + assert not self.pjlink.priority_queue, 'Priority queue should be empty' + assert not mock_reset.called, 'reset_information() should not have been called' assert mock_send_command.called, '_underscore_send_command() should have been called' @patch.object(openlp.core.projectors.pjlink.PJLink, 'state') @@ -540,9 +540,9 @@ class TestPJLinkBase(TestCase): mock_log.debug.assert_has_calls(log_debug_calls) mock_log.warning.assert_has_calls(log_warning_calls) mock_log.error.assert_has_calls(log_error_calls) - assert (not self.pjlink.send_queue), 'Send queue should be empty' - assert (self.pjlink.priority_queue == [test_command]), 'Priority queue should have one entry' - assert (not mock_reset.called), 'reset_information() should not have been called' + assert not self.pjlink.send_queue, 'Send queue should be empty' + assert self.pjlink.priority_queue == [test_command], 'Priority queue should have one entry' + assert not mock_reset.called, 'reset_information() should not have been called' assert mock_send_command.called, '_underscore_send_command() should have been called' @patch.object(openlp.core.projectors.pjlink.PJLink, 'state') @@ -569,10 +569,10 @@ class TestPJLinkBase(TestCase): mock_log.debug.assert_has_calls(log_debug_calls) mock_log.warning.assert_has_calls(log_warning_calls) mock_log.error.assert_has_calls(log_error_calls) - assert (not self.pjlink.send_queue), 'Send queue should be empty' - assert (not self.pjlink.priority_queue), 'Priority queue should be empty' - assert (not mock_reset.called), 'reset_information() should not have been called' - assert (not mock_send_command.called), '_underscore_send_command() should not have been called' + assert not self.pjlink.send_queue, 'Send queue should be empty' + assert not self.pjlink.priority_queue, 'Priority queue should be empty' + assert not mock_reset.called, 'reset_information() should not have been called' + assert not mock_send_command.called, '_underscore_send_command() should not have been called' @patch.object(openlp.core.projectors.pjlink.PJLink, 'state') @patch.object(openlp.core.projectors.pjlink.PJLink, 'reset_information') @@ -602,8 +602,8 @@ class TestPJLinkBase(TestCase): mock_log.warning.assert_has_calls(log_warning_calls) mock_log.error.assert_has_calls(log_error_calls) assert self.pjlink.send_queue, 'Send queue should have one entry' - assert (not self.pjlink.priority_queue), 'Priority queue should be empty' - assert (not mock_reset.called), 'reset_information() should not have been called' + assert not self.pjlink.priority_queue, 'Priority queue should be empty' + assert not mock_reset.called, 'reset_information() should not have been called' assert mock_send_command.called, '_underscore_send_command() should have been called' @patch.object(openlp.core.projectors.pjlink.PJLink, 'state') @@ -633,9 +633,9 @@ class TestPJLinkBase(TestCase): mock_log.debug.assert_has_calls(log_debug_calls) mock_log.warning.assert_has_calls(log_warning_calls) mock_log.error.assert_has_calls(log_error_calls) - assert (not self.pjlink.send_queue), 'Send queue should be empty' + assert not self.pjlink.send_queue, 'Send queue should be empty' assert self.pjlink.priority_queue, 'Priority queue should have one entry' - assert (not mock_reset.called), 'reset_information() should not have been called' + assert not mock_reset.called, 'reset_information() should not have been called' assert mock_send_command.called, '_underscore_send_command() should have been called' @patch.object(openlp.core.projectors.pjlink.PJLink, 'state') @@ -661,7 +661,7 @@ class TestPJLinkBase(TestCase): mock_log.debug.assert_has_calls(log_debug_calls) mock_log.warning.assert_has_calls(log_warning_calls) mock_log.error.assert_has_calls(log_error_calls) - assert (not self.pjlink.send_queue), 'Send queue should be empty' - assert (not self.pjlink.priority_queue), 'Priority queue should be empty' + assert not self.pjlink.send_queue, 'Send queue should be empty' + assert not self.pjlink.priority_queue, 'Priority queue should be empty' assert mock_reset.called, 'reset_information() should have been called' - assert (not mock_send_command.called), '_underscore_send_command() should not have been called' + assert not mock_send_command.called, '_underscore_send_command() should not have been called'