From 6fc1467c5a15e0aff3648d6cc8e2e9df92929fa4 Mon Sep 17 00:00:00 2001 From: Philip Ridout Date: Fri, 2 Sep 2016 15:32:14 +0100 Subject: [PATCH] PEP fixes --- openlp/plugins/bibles/lib/importers/zefania.py | 3 ++- .../openlp_plugins/bibles/test_bibleimport.py | 11 +++++------ .../openlp_plugins/bibles/test_opensongimport.py | 10 ++++++---- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/openlp/plugins/bibles/lib/importers/zefania.py b/openlp/plugins/bibles/lib/importers/zefania.py index 7265c32ac..5d8bddf4e 100644 --- a/openlp/plugins/bibles/lib/importers/zefania.py +++ b/openlp/plugins/bibles/lib/importers/zefania.py @@ -79,7 +79,8 @@ class ZefaniaBible(BibleImport): chapter_number = CHAPTER.get("cnumber") for VERS in CHAPTER: verse_number = VERS.get("vnumber") - self.create_verse(db_book.id, int(chapter_number), int(verse_number), VERS.text.replace('
', '\n')) + self.create_verse( + db_book.id, int(chapter_number), int(verse_number), VERS.text.replace('
', '\n')) self.wizard.increment_progress_bar( translate('BiblesPlugin.Zefnia', 'Importing {book} {chapter}...').format(book=db_book.name, diff --git a/tests/functional/openlp_plugins/bibles/test_bibleimport.py b/tests/functional/openlp_plugins/bibles/test_bibleimport.py index de7c935a0..d293150b5 100644 --- a/tests/functional/openlp_plugins/bibles/test_bibleimport.py +++ b/tests/functional/openlp_plugins/bibles/test_bibleimport.py @@ -173,8 +173,8 @@ class TestBibleImport(TestCase): # THEN: None should be returned and an error should be logged mocked_languages_get_language.assert_called_once_with('Qwerty') mocked_db_get_language.assert_called_once_with('KJV') - self.mocked_log.error.assert_called_once_with('Language detection failed when importing from "KJV". ' - 'User aborted language selection.') + self.mocked_log.error.assert_called_once_with( + 'Language detection failed when importing from "KJV". User aborted language selection.') self.assertFalse(instance.save_meta.called) self.assertIsNone(result) @@ -418,8 +418,7 @@ class TestBibleImport(TestCase): Test that validate_xml_file raises a ValidationError with an Zefania root tag """ # GIVEN: Some test data with an Zefania root tag and an instance of BibleImport - with patch.object(BibleImport, 'parse_xml', - return_value=objectify.fromstring('')), \ + with patch.object(BibleImport, 'parse_xml', return_value=objectify.fromstring('')), \ patch.object(BibleImport, 'is_compressed', return_value=False): importer = BibleImport(MagicMock(), path='.', name='.', filename='') @@ -437,8 +436,8 @@ class TestBibleImport(TestCase): Test that validate_xml_file raises a ValidationError with an unknown root tag """ # GIVEN: Some test data with an unknown root tag and an instance of BibleImport - with patch.object(BibleImport, 'parse_xml', - return_value=objectify.fromstring('')), \ + with patch.object( + BibleImport, 'parse_xml', return_value=objectify.fromstring('')), \ patch.object(BibleImport, 'is_compressed', return_value=False): importer = BibleImport(MagicMock(), path='.', name='.', filename='') diff --git a/tests/functional/openlp_plugins/bibles/test_opensongimport.py b/tests/functional/openlp_plugins/bibles/test_opensongimport.py index 1ebf7dd73..c902440b0 100644 --- a/tests/functional/openlp_plugins/bibles/test_opensongimport.py +++ b/tests/functional/openlp_plugins/bibles/test_opensongimport.py @@ -217,7 +217,8 @@ 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(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) @@ -325,9 +326,9 @@ class TestOpenSongImport(TestCase, TestMixin): """ # GIVEN: An instance of OpenSongBible and a mocked parse_xml which returns False with patch('openlp.plugins.bibles.lib.importers.opensong.log'), \ - patch.object(OpenSongBible, 'validate_xml_file'), \ - patch.object(OpenSongBible, 'parse_xml', return_value=None), \ - patch.object(OpenSongBible, 'get_language_id') as mocked_language_id: + patch.object(OpenSongBible, 'validate_xml_file'), \ + patch.object(OpenSongBible, 'parse_xml', return_value=None), \ + patch.object(OpenSongBible, 'get_language_id') as mocked_language_id: importer = OpenSongBible(MagicMock(), path='.', name='.', filename='') # WHEN: Calling do_import @@ -374,6 +375,7 @@ class TestOpenSongImport(TestCase, TestMixin): # THEN: do_import should return True self.assertTrue(result) + class TestOpenSongImportFileImports(TestCase, TestMixin): """ Test the functions in the :mod:`opensongimport` module.