diff --git a/tests/functional/openlp_core/common/test_actions.py b/tests/functional/openlp_core/common/test_actions.py index b2b38584d..7d5ac6fca 100644 --- a/tests/functional/openlp_core/common/test_actions.py +++ b/tests/functional/openlp_core/common/test_actions.py @@ -141,7 +141,7 @@ class TestCategoryActionList(TestCase): assert self.action1 not in self.list # THEN: Check if an exception is raised when trying to remove a not present action. - assertRaises(ValueError, self.list.remove, self.action2) + self.assertRaises(ValueError, self.list.remove, self.action2) class TestActionList(TestCase, TestMixin): diff --git a/tests/functional/openlp_core/common/test_init.py b/tests/functional/openlp_core/common/test_init.py index ae76ba122..9965a07ee 100644 --- a/tests/functional/openlp_core/common/test_init.py +++ b/tests/functional/openlp_core/common/test_init.py @@ -183,7 +183,7 @@ class TestInit(TestCase, TestMixin): # WHEN: Calling get_uno_command # THEN: a FileNotFoundError exception should be raised - assertRaises(FileNotFoundError, get_uno_command) + self.assertRaises(FileNotFoundError, get_uno_command) def test_get_uno_command_connection_type(self): """ diff --git a/tests/functional/openlp_core/projectors/test_projector_db.py b/tests/functional/openlp_core/projectors/test_projector_db.py index 5d1ddebaa..1dfe47a54 100644 --- a/tests/functional/openlp_core/projectors/test_projector_db.py +++ b/tests/functional/openlp_core/projectors/test_projector_db.py @@ -159,7 +159,7 @@ class TestProjectorDB(TestCase): record = self.projector.get_projector_by_ip(TEST2_DATA['ip']) # THEN: Verify proper record returned - assertTrue(compare_data(Projector(**TEST2_DATA), record), + self.assertTrue(compare_data(Projector(**TEST2_DATA), record), 'Record found should have been test_2 data') def test_find_record_by_name(self): @@ -173,7 +173,7 @@ class TestProjectorDB(TestCase): record = self.projector.get_projector_by_name(TEST2_DATA['name']) # THEN: Verify proper record returned - assertTrue(compare_data(Projector(**TEST2_DATA), record), + self.assertTrue(compare_data(Projector(**TEST2_DATA), record), 'Record found should have been test_2 data') def test_record_delete(self): @@ -189,7 +189,7 @@ class TestProjectorDB(TestCase): # THEN: Verify record not retrievable found = self.projector.get_projector_by_ip(TEST3_DATA['ip']) - assertFalse(found, 'test_3 record should have been deleted') + self.assertFalse(found, 'test_3 record should have been deleted') def test_record_edit(self): """ @@ -214,7 +214,7 @@ class TestProjectorDB(TestCase): record.model_filter = TEST3_DATA['model_filter'] record.model_lamp = TEST3_DATA['model_lamp'] updated = self.projector.update_projector(record) - assertTrue(updated, 'Save updated record should have returned True') + self.assertTrue(updated, 'Save updated record should have returned True') record = self.projector.get_projector_by_ip(TEST3_DATA['ip']) # THEN: Record ID should remain the same, but data should be changed diff --git a/tests/functional/openlp_core/widgets/test_views.py b/tests/functional/openlp_core/widgets/test_views.py index f611670ed..0365f7612 100644 --- a/tests/functional/openlp_core/widgets/test_views.py +++ b/tests/functional/openlp_core/widgets/test_views.py @@ -402,7 +402,7 @@ class TestListPreviewWidget(TestCase): list_preview_widget.row_resized(0, 100, 150) # THEN: self.cellWidget(row, 0).children()[1].setMaximumWidth() should fail - assertRaises(Exception) + self.assertRaises(Exception) @patch(u'openlp.core.widgets.views.ListPreviewWidget.selectRow') @patch(u'openlp.core.widgets.views.ListPreviewWidget.scrollToItem') diff --git a/tests/functional/openlp_plugins/media/test_mediaplugin.py b/tests/functional/openlp_plugins/media/test_mediaplugin.py index d68be3837..e22c31c7e 100644 --- a/tests/functional/openlp_plugins/media/test_mediaplugin.py +++ b/tests/functional/openlp_plugins/media/test_mediaplugin.py @@ -58,7 +58,7 @@ class MediaPluginTest(TestCase, TestMixin): # THEN: about() should return a string object assert isinstance(MediaPlugin.about(), str) # THEN: about() should return a non-empty string - self.assertNotEquals(len(MediaPlugin.about()), 0) + assert len(MediaPlugin.about()) is not 0 @patch('openlp.plugins.media.mediaplugin.check_binary_exists') def test_process_check_binary_pass(self, mocked_checked_binary_exists): diff --git a/tests/functional/openlp_plugins/songs/test_ewimport.py b/tests/functional/openlp_plugins/songs/test_ewimport.py index 386785e38..67ba909ff 100644 --- a/tests/functional/openlp_plugins/songs/test_ewimport.py +++ b/tests/functional/openlp_plugins/songs/test_ewimport.py @@ -217,7 +217,7 @@ class TestEasyWorshipSongImport(TestCase): for field_name in non_existing_fields: # THEN: The importer object should not be None - assertRaises(IndexError, importer.db_find_field, field_name) + self.assertRaises(IndexError, importer.db_find_field, field_name) def test_set_record_struct(self): """ diff --git a/tests/functional/openlp_plugins/songs/test_openlyricsimport.py b/tests/functional/openlp_plugins/songs/test_openlyricsimport.py index 1c916ea9f..90ea1ba48 100644 --- a/tests/functional/openlp_plugins/songs/test_openlyricsimport.py +++ b/tests/functional/openlp_plugins/songs/test_openlyricsimport.py @@ -153,9 +153,8 @@ class TestOpenLyricsImport(TestCase, TestMixin): ol._process_formatting_tags(song_xml, False) # THEN: New tags should have been saved - assertListEqual(json.loads(json.dumps(result_tags)), - json.loads(str(Settings().value('formattingTags/html_tags'))), - 'The formatting tags should contain both the old and the new') + assert json.loads(json.dumps(result_tags)) == json.loads(str(Settings().value('formattingTags/html_tags'))), \ + 'The formatting tags should contain both the old and the new' def test_process_author(self): """ diff --git a/tests/functional/openlp_plugins/songusage/test_songusage.py b/tests/functional/openlp_plugins/songusage/test_songusage.py index 916d7503b..fb4166c0c 100644 --- a/tests/functional/openlp_plugins/songusage/test_songusage.py +++ b/tests/functional/openlp_plugins/songusage/test_songusage.py @@ -45,8 +45,8 @@ class TestSongUsage(TestCase): # THEN: about() should return a string object assert isinstance(SongUsagePlugin.about(), str) # THEN: about() should return a non-empty string - assertNotEquals(len(SongUsagePlugin.about()), 0) - assertNotEquals(len(SongUsagePlugin.about()), 0) + assert len(SongUsagePlugin.about()) is not 0 + assert len(SongUsagePlugin.about()) is not 0 @patch('openlp.plugins.songusage.songusageplugin.Manager') def test_song_usage_init(self, MockedManager): diff --git a/tests/interfaces/openlp_core/lib/test_pluginmanager.py b/tests/interfaces/openlp_core/lib/test_pluginmanager.py index aef324228..ad1fb4194 100644 --- a/tests/interfaces/openlp_core/lib/test_pluginmanager.py +++ b/tests/interfaces/openlp_core/lib/test_pluginmanager.py @@ -86,11 +86,11 @@ class TestPluginManager(TestCase, TestMixin): # THEN: We should find the "Songs", "Bibles", etc in the plugins list plugin_names = [plugin.name for plugin in plugin_manager.plugins] - assertIn('songs', plugin_names, 'There should be a "songs" plugin') - assertIn('bibles', plugin_names, 'There should be a "bibles" plugin') - assertIn('presentations', plugin_names, 'There should be a "presentations" plugin') - assertIn('images', plugin_names, 'There should be a "images" plugin') - assertIn('media', plugin_names, 'There should be a "media" plugin') - assertIn('custom', plugin_names, 'There should be a "custom" plugin') - assertIn('songusage', plugin_names, 'There should be a "songusage" plugin') - assertIn('alerts', plugin_names, 'There should be a "alerts" plugin') + assert 'songs' in plugin_names, 'There should be a "songs" plugin' + assert 'bibles' in plugin_names, 'There should be a "bibles" plugin' + assert 'presentations' in plugin_names, 'There should be a "presentations" plugin' + assert 'images' in plugin_names, 'There should be a "images" plugin' + assert 'media' in plugin_names, 'There should be a "media" plugin' + assert 'custom' in plugin_names, 'There should be a "custom" plugin' + assert 'songusage'in plugin_names, 'There should be a "songusage" plugin' + assert 'alerts' in plugin_names, 'There should be a "alerts" plugin' diff --git a/tests/interfaces/openlp_core/ui/test_servicemanager.py b/tests/interfaces/openlp_core/ui/test_servicemanager.py index e384b3cb7..ebe452d67 100644 --- a/tests/interfaces/openlp_core/ui/test_servicemanager.py +++ b/tests/interfaces/openlp_core/ui/test_servicemanager.py @@ -470,7 +470,7 @@ class TestServiceManager(TestCase, TestMixin): selected_index = self.service_manager.service_manager_list.currentIndex() assert self.service_manager.service_manager_list.isExpanded(selected_index) is False, \ 'Item should have been collapsed' - assert self.service_manager.service_manager_list.currentItem() == song_item is True, \ + assert self.service_manager.service_manager_list.currentItem() == song_item, \ 'Top item should have been selected' self.service_manager.collapsed.assert_called_once_with(song_item) @@ -493,6 +493,6 @@ class TestServiceManager(TestCase, TestMixin): selected_index = self.service_manager.service_manager_list.currentIndex() assert self.service_manager.service_manager_list.isExpanded(selected_index) is False, \ 'Item should have been collapsed' - assert self.service_manager.service_manager_list.currentItem() == song_item is True, \ + assert self.service_manager.service_manager_list.currentItem() == song_item, \ 'Top item should have been selected' self.service_manager.collapsed.assert_called_once_with(song_item)