From dd53bfd157f5860e2b4e2a03e146bada1f705a37 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 22 Dec 2017 16:53:40 +0000 Subject: [PATCH] functional bibles --- .../openlp_plugins/bibles/test_bibleserver.py | 16 ++--- .../openlp_plugins/bibles/test_lib.py | 42 ++++++------ .../openlp_plugins/bibles/test_manager.py | 4 +- .../bibles/test_opensongimport.py | 67 +++++++++---------- .../openlp_plugins/bibles/test_osisimport.py | 2 +- .../bibles/test_versereferencelist.py | 31 ++++----- .../bibles/test_zefaniaimport.py | 6 +- .../openlp_plugins/images/test_lib.py | 4 +- .../openlp_plugins/media/test_mediaplugin.py | 2 +- .../test_presentationcontroller.py | 4 +- .../songs/test_openlyricsimport.py | 2 +- .../openlp_plugins/songs/test_songselect.py | 6 +- .../songs/test_zionworximport.py | 2 +- .../songusage/test_songusage.py | 2 +- 14 files changed, 91 insertions(+), 99 deletions(-) diff --git a/tests/functional/openlp_plugins/bibles/test_bibleserver.py b/tests/functional/openlp_plugins/bibles/test_bibleserver.py index bc05a601f..5d88b09b3 100644 --- a/tests/functional/openlp_plugins/bibles/test_bibleserver.py +++ b/tests/functional/openlp_plugins/bibles/test_bibleserver.py @@ -75,9 +75,8 @@ class TestBSExtract(TestCase): self.mock_urllib.parse.quote.assert_called_once_with(b'NIV') self.mock_get_soup_for_bible_ref.assert_called_once_with( 'http://m.bibleserver.com/overlay/selectBook?translation=NIV') - self.assertIsNone(result, - 'BSExtract.get_books_from_http should return None when get_soup_for_bible_ref returns a ' - 'false value') + assert result is None, \ + 'BSExtract.get_books_from_http should return None when get_soup_for_bible_ref returns a false value' def test_get_books_from_http_no_content(self): """ @@ -106,9 +105,8 @@ class TestBSExtract(TestCase): self.mock_soup.find.assert_called_once_with('ul') self.mock_log.error.assert_called_once_with('No books found in the Bibleserver response.') self.mock_send_error_message.assert_called_once_with('parse') - self.assertIsNone(result, - 'BSExtract.get_books_from_http should return None when get_soup_for_bible_ref returns a ' - 'false value') + assert result is None, \ + 'BSExtract.get_books_from_http should return None when get_soup_for_bible_ref returns a false value' def test_get_books_from_http_content(self): """ @@ -138,6 +136,6 @@ class TestBSExtract(TestCase): self.mock_urllib.parse.quote.assert_called_once_with(b'NIV') self.mock_get_soup_for_bible_ref.assert_called_once_with( 'http://m.bibleserver.com/overlay/selectBook?translation=NIV') - self.assertFalse(self.mock_log.error.called, 'log.error should not have been called') - self.assertFalse(self.mock_send_error_message.called, 'send_error_message should not have been called') - self.assertEqual(result, ['Genesis', 'Leviticus']) + assert self.mock_log.error.called is False, 'log.error should not have been called' + assert self.mock_send_error_message.called is False, 'send_error_message should not have been called' + assert result == ['Genesis', 'Leviticus'] diff --git a/tests/functional/openlp_plugins/bibles/test_lib.py b/tests/functional/openlp_plugins/bibles/test_lib.py index 5ae8ae85d..95d8ce7fb 100644 --- a/tests/functional/openlp_plugins/bibles/test_lib.py +++ b/tests/functional/openlp_plugins/bibles/test_lib.py @@ -59,7 +59,7 @@ class TestLib(TestCase, TestMixin): _ = lib.get_reference_separator(key) # THEN: get_reference_separator should return the correct separator - self.assertEqual(separators[key], value) + assert separators[key] == value mocked_update_reference_separators.assert_called_once_with() def test_reference_matched_full(self): @@ -116,13 +116,13 @@ class TestLib(TestCase, TestMixin): # THEN: A match should be returned, and the book and reference should match the # expected result - self.assertIsNotNone(match, '{text} should provide a match'.format(text=reference_text)) - self.assertEqual(book_result, match.group('book'), - '{text} does not provide the expected result for the book group.' - .format(text=reference_text)) - self.assertEqual(ranges_result, match.group('ranges'), - '{text} does not provide the expected result for the ranges group.' - .format(text=reference_text)) + assert match is not None, '{text} should provide a match'.format(text=reference_text) + assert book_result, match.group('book') == \ + '{text} does not provide the expected result for the book group.'\ + .format(text=reference_text) + assert ranges_result, match.group('ranges') == \ + '{text} does not provide the expected result for the ranges group.' \ + .format(text=reference_text) def test_reference_matched_range(self): """ @@ -158,12 +158,12 @@ class TestLib(TestCase, TestMixin): # THEN: A match should be returned, and the to/from chapter/verses should match as # expected - self.assertIsNotNone(match, '{text} should provide a match'.format(text=reference_text)) - self.assertEqual(match.group('from_chapter'), from_chapter) - self.assertEqual(match.group('from_verse'), from_verse) - self.assertEqual(match.group('range_to'), range_to) - self.assertEqual(match.group('to_chapter'), to_chapter) - self.assertEqual(match.group('to_verse'), to_verse) + assert match is not None, '{text} should provide a match'.format(text=reference_text) + assert match.group('from_chapter') == from_chapter + assert match.group('from_verse') == from_verse + assert match.group('range_to') == range_to + assert match.group('to_chapter') == to_chapter + assert match.group('to_verse') == to_verse def test_reference_matched_range_separator(self): # GIVEN: Some test data which contains different references to parse, with the expected results. @@ -199,7 +199,7 @@ class TestLib(TestCase, TestMixin): references = full_reference_match.split(reference_text) # THEN: The list of references should be as the expected results - self.assertEqual(references, ranges) + assert references == ranges def test_search_results_creation(self): """ @@ -218,10 +218,10 @@ class TestLib(TestCase, TestMixin): search_results = SearchResults(book, chapter, verse_list) # THEN: It should have a book, a chapter and a verse list - self.assertIsNotNone(search_results, 'The search_results object should not be None') - self.assertEqual(search_results.book, book, 'The book should be "Genesis"') - self.assertEqual(search_results.chapter, chapter, 'The chapter should be 1') - self.assertDictEqual(search_results.verse_list, verse_list, 'The verse lists should be identical') + assert search_results is not None, 'The search_results object should not be None' + assert search_results.book == book, 'The book should be "Genesis"' + assert search_results.chapter == chapter, 'The chapter should be 1' + assert search_results.verse_list == verse_list, 'The verse lists should be identical' def test_search_results_has_verse_list(self): """ @@ -234,7 +234,7 @@ class TestLib(TestCase, TestMixin): has_verse_list = search_results.has_verse_list() # THEN: It should be True - self.assertTrue(has_verse_list, 'The SearchResults object should have a verse list') + assert has_verse_list is True, 'The SearchResults object should have a verse list' def test_search_results_has_no_verse_list(self): """ @@ -247,4 +247,4 @@ class TestLib(TestCase, TestMixin): has_verse_list = search_results.has_verse_list() # THEN: It should be False - self.assertFalse(has_verse_list, 'The SearchResults object should have a verse list') + assert has_verse_list is False, 'The SearchResults object should have a verse list' diff --git a/tests/functional/openlp_plugins/bibles/test_manager.py b/tests/functional/openlp_plugins/bibles/test_manager.py index 73e64d130..bc22f20c2 100644 --- a/tests/functional/openlp_plugins/bibles/test_manager.py +++ b/tests/functional/openlp_plugins/bibles/test_manager.py @@ -63,7 +63,7 @@ class TestManager(TestCase): # THEN: The session should have been closed and set to None, the bible should be deleted, and the result of # the deletion returned. - self.assertTrue(result) + assert result is True mocked_close_all.assert_called_once_with() - self.assertIsNone(mocked_bible.session) + assert mocked_bible.session is None mocked_delete_file.assert_called_once_with(Path('bibles', 'KJV.sqlite')) diff --git a/tests/functional/openlp_plugins/bibles/test_opensongimport.py b/tests/functional/openlp_plugins/bibles/test_opensongimport.py index eab4d33a9..7c9683d65 100644 --- a/tests/functional/openlp_plugins/bibles/test_opensongimport.py +++ b/tests/functional/openlp_plugins/bibles/test_opensongimport.py @@ -68,7 +68,7 @@ class TestOpenSongImport(TestCase, TestMixin): importer = OpenSongBible(mocked_manager, path='.', name='.', file_path=None) # THEN: The importer should be an instance of BibleDB - self.assertIsInstance(importer, BibleImport) + assert isinstance(importer, BibleImport) def test_get_text_no_text(self): """ @@ -81,7 +81,7 @@ class TestOpenSongImport(TestCase, TestMixin): result = get_text(test_data) # THEN: A blank string should be returned - self.assertEqual(result, '') + assert result == '' def test_get_text_text(self): """ @@ -98,7 +98,7 @@ class TestOpenSongImport(TestCase, TestMixin): result = get_text(test_data) # THEN: The text returned should be as expected - self.assertEqual(result, 'Element text sub_text_tail text sub_text_tail tail sub_text text sub_tail tail') + assert result == 'Element text sub_text_tail text sub_text_tail tail sub_text text sub_tail tail' def test_parse_chapter_number(self): """ @@ -109,7 +109,7 @@ class TestOpenSongImport(TestCase, TestMixin): result = parse_chapter_number('10', 0) # THEN: The 10 should be returned as an Int - self.assertEqual(result, 10) + assert result == 10 def test_parse_chapter_number_empty_attribute(self): """ @@ -120,7 +120,7 @@ class TestOpenSongImport(TestCase, TestMixin): result = parse_chapter_number('', 12) # THEN: parse_chapter_number should increment the previous verse number - self.assertEqual(result, 13) + assert result == 13 def test_parse_verse_number_valid_verse_no(self): """ @@ -133,7 +133,7 @@ class TestOpenSongImport(TestCase, TestMixin): result = importer.parse_verse_number('15', 0) # THEN: parse_verse_number should return the verse number - self.assertEqual(result, 15) + assert result == 15 def test_parse_verse_number_verse_range(self): """ @@ -146,7 +146,7 @@ class TestOpenSongImport(TestCase, TestMixin): result = importer.parse_verse_number('24-26', 0) # THEN: parse_verse_number should return the first verse number in the range - self.assertEqual(result, 24) + assert result == 24 def test_parse_verse_number_invalid_verse_no(self): """ @@ -159,7 +159,7 @@ class TestOpenSongImport(TestCase, TestMixin): result = importer.parse_verse_number('invalid', 41) # THEN: parse_verse_number should increment the previous verse number - self.assertEqual(result, 42) + assert result == 42 def test_parse_verse_number_empty_attribute(self): """ @@ -171,7 +171,7 @@ class TestOpenSongImport(TestCase, TestMixin): result = importer.parse_verse_number('', 14) # THEN: parse_verse_number should increment the previous verse number - self.assertEqual(result, 15) + assert result == 15 def test_parse_verse_number_invalid_type(self): """ @@ -187,7 +187,7 @@ class TestOpenSongImport(TestCase, TestMixin): # THEN: parse_verse_number should log the verse number it was called with increment the previous verse # number mocked_log_warning.assert_called_once_with('Illegal verse number: (1, 2, 3)') - self.assertEqual(result, 13) + assert result == 13 def test_process_books_stop_import(self): """ @@ -201,7 +201,7 @@ class TestOpenSongImport(TestCase, TestMixin): importer.process_books(['Book']) # THEN: find_and_create_book should not have been called - self.assertFalse(self.mocked_find_and_create_book.called) + assert self.mocked_find_and_create_book.called is False def test_process_books_completes(self): """ @@ -226,11 +226,10 @@ class TestOpenSongImport(TestCase, TestMixin): importer.process_books([book1, book2]) # THEN: find_and_create_book and process_books should be called with the details from the mocked books - self.assertEqual(self.mocked_find_and_create_book.call_args_list, - [call('Name1', 2, 10), call('Name2', 2, 10)]) - self.assertEqual(mocked_process_chapters.call_args_list, - [call('db_book1', 'Chapter1'), call('db_book2', 'Chapter2')]) - self.assertEqual(importer.session.commit.call_count, 2) + assert self.mocked_find_and_create_book.call_args_list == [call('Name1', 2, 10), call('Name2', 2, 10)] + assert mocked_process_chapters.call_args_list == \ + [call('db_book1', 'Chapter1'), call('db_book2', 'Chapter2')] + assert importer.session.commit.call_count == 2 def test_process_chapters_stop_import(self): """ @@ -245,7 +244,7 @@ class TestOpenSongImport(TestCase, TestMixin): importer.process_chapters('Book', ['Chapter1']) # THEN: importer.parse_chapter_number not have been called - self.assertFalse(importer.parse_chapter_number.called) + assert importer.parse_chapter_number.called is False @patch('openlp.plugins.bibles.lib.importers.opensong.parse_chapter_number', **{'side_effect': [1, 2]}) def test_process_chapters_completes(self, mocked_parse_chapter_number): @@ -273,12 +272,11 @@ class TestOpenSongImport(TestCase, TestMixin): importer.process_chapters(book, [chapter1, chapter2]) # THEN: parse_chapter_number, process_verses and increment_process_bar should have been called - self.assertEqual(mocked_parse_chapter_number.call_args_list, [call('1', 0), call('2', 1)]) - self.assertEqual( - importer.process_verses.call_args_list, - [call(book, 1, ['Chapter1 Verses']), call(book, 2, ['Chapter2 Verses'])]) - self.assertEqual(importer.wizard.increment_progress_bar.call_args_list, - [call('Importing Book 1...'), call('Importing Book 2...')]) + assert mocked_parse_chapter_number.call_args_list == [call('1', 0), call('2', 1)] + assert importer.process_verses.call_args_list == \ + [call(book, 1, ['Chapter1 Verses']), call(book, 2, ['Chapter2 Verses'])] + assert importer.wizard.increment_progress_bar.call_args_list == [call('Importing Book 1...'), + call('Importing Book 2...')] def test_process_verses_stop_import(self): """ @@ -293,7 +291,7 @@ class TestOpenSongImport(TestCase, TestMixin): importer.process_verses('Book', 1, 'Verses') # THEN: importer.parse_verse_number not have been called - self.assertFalse(importer.parse_verse_number.called) + assert importer.parse_verse_number.called is False def test_process_verses_completes(self): """ @@ -324,11 +322,10 @@ class TestOpenSongImport(TestCase, TestMixin): importer.process_verses(book, 1, [verse1, verse2]) # THEN: parse_chapter_number, process_verses and increment_process_bar should have been called - self.assertEqual(mocked_parse_verse_number.call_args_list, [call('1', 0), call('2', 1)]) - self.assertEqual(mocked_get_text.call_args_list, [call(verse1), call(verse2)]) - self.assertEqual( - importer.create_verse.call_args_list, - [call(1, 1, 1, 'Verse1 Text'), call(1, 1, 2, 'Verse2 Text')]) + assert mocked_parse_verse_number.call_args_list == [call('1', 0), call('2', 1)] + assert mocked_get_text.call_args_list == [call(verse1), call(verse2)] + assert importer.create_verse.call_args_list == \ + [call(1, 1, 1, 'Verse1 Text'), call(1, 1, 2, 'Verse2 Text')] def test_do_import_parse_xml_fails(self): """ @@ -345,8 +342,8 @@ class TestOpenSongImport(TestCase, TestMixin): result = importer.do_import() # THEN: do_import should return False and get_language_id should have not been called - self.assertFalse(result) - self.assertFalse(mocked_language_id.called) + assert result is False + assert mocked_language_id.called is False def test_do_import_no_language(self): """ @@ -364,8 +361,8 @@ class TestOpenSongImport(TestCase, TestMixin): result = importer.do_import() # THEN: do_import should return False and process_books should have not been called - self.assertFalse(result) - self.assertFalse(mocked_process_books.called) + assert result is False + assert mocked_process_books.called is False def test_do_import_completes(self): """ @@ -383,7 +380,7 @@ class TestOpenSongImport(TestCase, TestMixin): result = importer.do_import() # THEN: do_import should return True - self.assertTrue(result) + assert result is True class TestOpenSongImportFileImports(TestCase, TestMixin): @@ -421,6 +418,6 @@ class TestOpenSongImportFileImports(TestCase, TestMixin): importer.do_import() # THEN: The create_verse() method should have been called with each verse in the file. - self.assertTrue(importer.create_verse.called) + assert importer.create_verse.called is True for verse_tag, verse_text in test_data['verses']: importer.create_verse.assert_any_call(importer.create_book().id, 1, int(verse_tag), verse_text) diff --git a/tests/functional/openlp_plugins/bibles/test_osisimport.py b/tests/functional/openlp_plugins/bibles/test_osisimport.py index 8c1b26abb..26d6ade29 100644 --- a/tests/functional/openlp_plugins/bibles/test_osisimport.py +++ b/tests/functional/openlp_plugins/bibles/test_osisimport.py @@ -207,7 +207,7 @@ class TestOsisImport(TestCase): # THEN: set_current_chapter should have been called with the test data mocked_set_current_chapter.assert_called_once_with(test_book.name, 2) - self.assertFalse(mocked_process_verse.called) + assert mocked_process_verse.called is False def test_process_chapters_milestones_verse_tag(self): """ diff --git a/tests/functional/openlp_plugins/bibles/test_versereferencelist.py b/tests/functional/openlp_plugins/bibles/test_versereferencelist.py index b40db5076..53439f681 100644 --- a/tests/functional/openlp_plugins/bibles/test_versereferencelist.py +++ b/tests/functional/openlp_plugins/bibles/test_versereferencelist.py @@ -48,14 +48,12 @@ class TestVerseReferenceList(TestCase): reference_list.add(book, chapter, verse, version, copyright_, permission) # THEN: The entries should be in the first entry of the list - self.assertEqual(reference_list.current_index, 0, 'The current index should be 0') - self.assertEqual(reference_list.verse_list[0]['book'], book, 'The book in first entry should be %s' % book) - self.assertEqual(reference_list.verse_list[0]['chapter'], chapter, 'The chapter in first entry should be %u' % - chapter) - self.assertEqual(reference_list.verse_list[0]['start'], verse, 'The start in first entry should be %u' % verse) - self.assertEqual(reference_list.verse_list[0]['version'], version, 'The version in first entry should be %s' % - version) - self.assertEqual(reference_list.verse_list[0]['end'], verse, 'The end in first entry should be %u' % verse) + assert reference_list.current_index == 0, 'The current index should be 0' + assert reference_list.verse_list[0]['book'] == book, 'The book in first entry should be %s' % book + assert reference_list.verse_list[0]['chapter'] == chapter, 'The chapter in first entry should be %u' % chapter + assert reference_list.verse_list[0]['start'] == verse, 'The start in first entry should be %u' % verse + assert reference_list.verse_list[0]['version'] == version, 'The version in first entry should be %s' % version + assert reference_list.verse_list[0]['end'] == verse, 'The end in first entry should be %u' % verse def test_add_next_verse(self): """ @@ -76,9 +74,8 @@ class TestVerseReferenceList(TestCase): reference_list.add(book, chapter, next_verse, version, copyright_, permission) # THEN: The current index should be 0 and the end pointer of the entry should be '2' - self.assertEqual(reference_list.current_index, 0, 'The current index should be 0') - self.assertEqual(reference_list.verse_list[0]['end'], next_verse, - 'The end in first entry should be %u' % next_verse) + assert reference_list.current_index == 0, 'The current index should be 0' + assert reference_list.verse_list[0]['end'] == next_verse, 'The end in first entry should be %u' % next_verse def test_add_another_verse(self): """ @@ -101,7 +98,7 @@ class TestVerseReferenceList(TestCase): reference_list.add(another_book, another_chapter, another_verse, version, copyright_, permission) # THEN: the current index should be 1 - self.assertEqual(reference_list.current_index, 1, 'The current index should be 1') + assert reference_list.current_index == 1, 'The current index should be 1' def test_add_version(self): """ @@ -117,10 +114,10 @@ class TestVerseReferenceList(TestCase): reference_list.add_version(version, copyright_, permission) # THEN: the data will be appended to the list - self.assertEqual(len(reference_list.version_list), 1, 'The version data should be appended') - self.assertEqual(reference_list.version_list[0], - {'version': version, 'copyright': copyright_, 'permission': permission}, - 'The version data should be appended') + assert len(reference_list.version_list) == 1, 'The version data should be appended' + assert reference_list.version_list[0] == \ + {'version': version, 'copyright': copyright_, 'permission': permission}, \ + 'The version data should be appended' def test_add_existing_version(self): """ @@ -137,4 +134,4 @@ class TestVerseReferenceList(TestCase): reference_list.add_version(version, copyright_, permission) # THEN: the data will not be appended to the list - self.assertEqual(len(reference_list.version_list), 1, 'The version data should not be appended') + assert len(reference_list.version_list) == 1, 'The version data should not be appended' diff --git a/tests/functional/openlp_plugins/bibles/test_zefaniaimport.py b/tests/functional/openlp_plugins/bibles/test_zefaniaimport.py index d423a2153..87fdf4f32 100644 --- a/tests/functional/openlp_plugins/bibles/test_zefaniaimport.py +++ b/tests/functional/openlp_plugins/bibles/test_zefaniaimport.py @@ -59,7 +59,7 @@ class TestZefaniaImport(TestCase): importer = ZefaniaBible(mocked_manager, path='.', name='.', file_path=None) # THEN: The importer should be an instance of BibleDB - self.assertIsInstance(importer, BibleDB) + assert isinstance(importer, BibleDB) def test_file_import(self): """ @@ -86,7 +86,7 @@ class TestZefaniaImport(TestCase): importer.do_import() # THEN: The create_verse() method should have been called with each verse in the file. - self.assertTrue(importer.create_verse.called) + assert importer.create_verse.called is True for verse_tag, verse_text in test_data['verses']: importer.create_verse.assert_any_call(importer.create_book().id, 1, verse_tag, verse_text) importer.create_book.assert_any_call('Genesis', 1, 1) @@ -116,7 +116,7 @@ class TestZefaniaImport(TestCase): importer.do_import() # THEN: The create_verse() method should have been called with each verse in the file. - self.assertTrue(importer.create_verse.called) + assert importer.create_verse.called is True for verse_tag, verse_text in test_data['verses']: importer.create_verse.assert_any_call(importer.create_book().id, 1, verse_tag, verse_text) importer.create_book.assert_any_call('Exodus', 2, 1) diff --git a/tests/functional/openlp_plugins/images/test_lib.py b/tests/functional/openlp_plugins/images/test_lib.py index 877ad722d..b6e990ebb 100644 --- a/tests/functional/openlp_plugins/images/test_lib.py +++ b/tests/functional/openlp_plugins/images/test_lib.py @@ -276,9 +276,9 @@ class TestImageMediaItem(TestCase): item = self.media_item.create_item_from_id('1') # THEN: A QTreeWidgetItem should be created with the above model object as it's data - self.assertIsInstance(item, QtWidgets.QTreeWidgetItem) + assert isinstance(item, QtWidgets.QTreeWidgetItem) self.assertEqual('test_file_1.jpg', item.text(0)) item_data = item.data(0, QtCore.Qt.UserRole) - self.assertIsInstance(item_data, ImageFilenames) + assert isinstance(item_data, ImageFilenames) self.assertEqual(1, item_data.id) self.assertEqual(Path('/', 'tmp', 'test_file_1.jpg'), item_data.file_path) diff --git a/tests/functional/openlp_plugins/media/test_mediaplugin.py b/tests/functional/openlp_plugins/media/test_mediaplugin.py index 3ab5b3034..2fc170272 100644 --- a/tests/functional/openlp_plugins/media/test_mediaplugin.py +++ b/tests/functional/openlp_plugins/media/test_mediaplugin.py @@ -56,7 +56,7 @@ class MediaPluginTest(TestCase, TestMixin): # GIVEN: The MediaPlugin # WHEN: Retrieving the about text # THEN: about() should return a string object - self.assertIsInstance(MediaPlugin.about(), str) + assert isinstance(MediaPlugin.about(), str) # THEN: about() should return a non-empty string self.assertNotEquals(len(MediaPlugin.about()), 0) diff --git a/tests/functional/openlp_plugins/presentations/test_presentationcontroller.py b/tests/functional/openlp_plugins/presentations/test_presentationcontroller.py index a921ef81e..749229b26 100644 --- a/tests/functional/openlp_plugins/presentations/test_presentationcontroller.py +++ b/tests/functional/openlp_plugins/presentations/test_presentationcontroller.py @@ -132,9 +132,9 @@ class TestPresentationController(TestCase): result_titles, result_notes = self.document.get_titles_and_notes() # THEN: it should return two empty lists - self.assertIsInstance(result_titles, list, 'result_titles should be of type list') + assert isinstance(result_titles, list, 'result_titles should be of type list') self.assertEqual(len(result_titles), 0, 'there be no titles') - self.assertIsInstance(result_notes, list, 'result_notes should be a list') + assert isinstance(result_notes, list, 'result_notes should be a list') self.assertEqual(len(result_notes), 0, 'but the list should be empty') def test_get_titles_and_notes_with_file_error(self): diff --git a/tests/functional/openlp_plugins/songs/test_openlyricsimport.py b/tests/functional/openlp_plugins/songs/test_openlyricsimport.py index 088711fbc..376ef9f7a 100644 --- a/tests/functional/openlp_plugins/songs/test_openlyricsimport.py +++ b/tests/functional/openlp_plugins/songs/test_openlyricsimport.py @@ -114,7 +114,7 @@ class TestOpenLyricsImport(TestCase, TestMixin): importer = OpenLyricsImport(mocked_manager, file_paths=[]) # THEN: The importer should be an instance of SongImport - self.assertIsInstance(importer, SongImport) + assert isinstance(importer, SongImport) def test_file_import(self): """ diff --git a/tests/functional/openlp_plugins/songs/test_songselect.py b/tests/functional/openlp_plugins/songs/test_songselect.py index fa2b2931d..5f8b2d6e6 100644 --- a/tests/functional/openlp_plugins/songs/test_songselect.py +++ b/tests/functional/openlp_plugins/songs/test_songselect.py @@ -427,7 +427,7 @@ class TestSongSelectImport(TestCase, TestMixin): result = importer.save_song(song_dict) # THEN: The return value should be a Song class and the mocked_db_manager should have been called - self.assertIsInstance(result, Song, 'The returned value should be a Song object') + assert isinstance(result, Song, 'The returned value should be a Song object') mocked_clean_song.assert_called_with(mocked_db_manager, result) self.assertEqual(2, mocked_db_manager.save_object.call_count, 'The save_object() method should have been called twice') @@ -463,7 +463,7 @@ class TestSongSelectImport(TestCase, TestMixin): result = importer.save_song(song_dict) # THEN: The return value should be a Song class and the mocked_db_manager should have been called - self.assertIsInstance(result, Song, 'The returned value should be a Song object') + assert isinstance(result, Song, 'The returned value should be a Song object') mocked_clean_song.assert_called_with(mocked_db_manager, result) self.assertEqual(2, mocked_db_manager.save_object.call_count, 'The save_object() method should have been called twice') @@ -498,7 +498,7 @@ class TestSongSelectImport(TestCase, TestMixin): result = importer.save_song(song_dict) # THEN: The return value should be a Song class and the mocked_db_manager should have been called - self.assertIsInstance(result, Song, 'The returned value should be a Song object') + assert isinstance(result, Song, 'The returned value should be a Song object') mocked_clean_song.assert_called_with(mocked_db_manager, result) self.assertEqual(2, mocked_db_manager.save_object.call_count, 'The save_object() method should have been called twice') diff --git a/tests/functional/openlp_plugins/songs/test_zionworximport.py b/tests/functional/openlp_plugins/songs/test_zionworximport.py index 42991382e..67e6c6ee6 100644 --- a/tests/functional/openlp_plugins/songs/test_zionworximport.py +++ b/tests/functional/openlp_plugins/songs/test_zionworximport.py @@ -59,7 +59,7 @@ class TestZionWorxImport(TestCase): importer = ZionWorxImport(mocked_manager, file_paths=[]) # THEN: The importer should be an instance of SongImport - self.assertIsInstance(importer, SongImport) + assert isinstance(importer, SongImport) class TestZionWorxFileImport(SongImportTestHelper): diff --git a/tests/functional/openlp_plugins/songusage/test_songusage.py b/tests/functional/openlp_plugins/songusage/test_songusage.py index 92f972271..4eb111018 100644 --- a/tests/functional/openlp_plugins/songusage/test_songusage.py +++ b/tests/functional/openlp_plugins/songusage/test_songusage.py @@ -43,7 +43,7 @@ class TestSongUsage(TestCase): # GIVEN: The SongUsagePlugin # WHEN: Retrieving the about text # THEN: about() should return a string object - self.assertIsInstance(SongUsagePlugin.about(), str) + assert isinstance(SongUsagePlugin.about(), str) # THEN: about() should return a non-empty string self.assertNotEquals(len(SongUsagePlugin.about()), 0) self.assertNotEquals(len(SongUsagePlugin.about()), 0)