forked from openlp/openlp
Pep fixes
This commit is contained in:
parent
e67f6dbd94
commit
849bbd2c51
@ -504,7 +504,7 @@ class BibleMediaItem(MediaManagerItem):
|
||||
self.second_combo_box.setCurrentIndex(self.second_combo_box.findData(self.second_bible))
|
||||
return
|
||||
self.second_bible = new_selection
|
||||
if new_selection == None:
|
||||
if new_selection is None:
|
||||
self.style_combo_box.setEnabled(True)
|
||||
else:
|
||||
self.style_combo_box.setEnabled(False)
|
||||
@ -669,8 +669,8 @@ class BibleMediaItem(MediaManagerItem):
|
||||
translate('BiblesPlugin.MediaItem',
|
||||
'The second Bible "{second_name}" does not contain all the verses that are in the main '
|
||||
'Bible "{name}".\nOnly verses found in both Bibles will be shown.\n\n'
|
||||
'{count:d} verses have not been included in the results.')
|
||||
.format(second_name=self.second_bible.name, name=self.bible.name, count=not_found_count))
|
||||
'{count:d} verses have not been included in the results.'
|
||||
).format(second_name=self.second_bible.name, name=self.bible.name, count=not_found_count))
|
||||
self.display_results()
|
||||
|
||||
def text_search(self, search_while_type=False):
|
||||
@ -707,7 +707,6 @@ class BibleMediaItem(MediaManagerItem):
|
||||
self.on_text_search(text)
|
||||
self.display_results()
|
||||
|
||||
|
||||
def on_search_edit_text_changed(self):
|
||||
"""
|
||||
If 'search_as_you_type' is enabled, start a timer when the search_edit emits a textChanged signal. This is to
|
||||
|
@ -99,7 +99,7 @@ class TestLib(TestCase, TestMixin):
|
||||
verse_separators = [':', ' : ', 'v', ' v ', 'V', ' V ', 'verse', ' verse ', 'verses', ' verses '] \
|
||||
if '{verse}' in reference_text else ['']
|
||||
and_separators = [',', ' , ', 'and', ' and '] if '{_and}' in reference_text else ['']
|
||||
end_separators = ['end', ' end '] if '{end}' in reference_text else [''];
|
||||
end_separators = ['end', ' end '] if '{end}' in reference_text else ['']
|
||||
|
||||
for to in to_separators:
|
||||
for verse in verse_separators:
|
||||
@ -141,7 +141,7 @@ class TestLib(TestCase, TestMixin):
|
||||
verse_separators = [':', ' : ', 'v', ' v ', 'V', ' V ', 'verse', ' verse ', 'verses', ' verses '] \
|
||||
if '{verse}' in reference_text else ['']
|
||||
and_separators = [',', ' , ', 'and', ' and '] if '{_and}' in reference_text else ['']
|
||||
end_separators = ['end', ' end '] if '{end}' in reference_text else [''];
|
||||
end_separators = ['end', ' end '] if '{end}' in reference_text else ['']
|
||||
|
||||
for to in to_separators:
|
||||
for verse in verse_separators:
|
||||
@ -183,7 +183,7 @@ class TestLib(TestCase, TestMixin):
|
||||
verse_separators = [':', ' : ', 'v', ' v ', 'V', ' V ', 'verse', ' verse ', 'verses', ' verses '] \
|
||||
if '{verse}' in reference_text else ['']
|
||||
and_separators = [',', ' , ', 'and', ' and '] if '{_and}' in reference_text else ['']
|
||||
end_separators = ['end', ' end '] if '{end}' in reference_text else [''];
|
||||
end_separators = ['end', ' end '] if '{end}' in reference_text else ['']
|
||||
|
||||
for to in to_separators:
|
||||
for verse in verse_separators:
|
||||
|
@ -156,8 +156,6 @@ class TestMediaItem(TestCase, TestMixin):
|
||||
self.mocked_bible_2 = MagicMock(**{'get_books.return_value': self.book_list_2})
|
||||
self.mocked_bible_2.name = 'Bible 2'
|
||||
|
||||
|
||||
|
||||
def test_media_item_instance(self):
|
||||
"""
|
||||
When creating an instance of C test that it is also an instance of
|
||||
@ -266,7 +264,8 @@ class TestMediaItem(TestCase, TestMixin):
|
||||
"""
|
||||
# GIVEN: An instance of :class:`MediaManagerItem` and mocked out settings class with known values
|
||||
self.setting_values = {'bibles/reset to combined quick search': False}
|
||||
with patch.object(self.media_item, 'populate_bible_combo_boxes'), patch.object(self.media_item, 'config_update'):
|
||||
with patch.object(self.media_item, 'populate_bible_combo_boxes'), \
|
||||
patch.object(self.media_item, 'config_update'):
|
||||
self.media_item.search_edit = MagicMock()
|
||||
|
||||
# WHEN: Calling initialise()
|
||||
@ -282,7 +281,8 @@ class TestMediaItem(TestCase, TestMixin):
|
||||
"""
|
||||
# GIVEN: An instance of :class:`MediaManagerItem` and mocked out settings class with known values
|
||||
self.setting_values = {'bibles/reset to combined quick search': True}
|
||||
with patch.object(self.media_item, 'populate_bible_combo_boxes'), patch.object(self.media_item, 'config_update'):
|
||||
with patch.object(self.media_item, 'populate_bible_combo_boxes'), \
|
||||
patch.object(self.media_item, 'config_update'):
|
||||
self.media_item.search_edit = MagicMock()
|
||||
|
||||
# WHEN: Calling initialise()
|
||||
@ -460,6 +460,7 @@ class TestMediaItem(TestCase, TestMixin):
|
||||
patch('openlp.plugins.bibles.lib.mediaitem.get_locale_key', side_effect=lambda x: x), \
|
||||
patch('openlp.plugins.bibles.lib.mediaitem.set_case_insensitive_completer') \
|
||||
as mocked_set_case_insensitive_completer:
|
||||
|
||||
# WHEN: Calling update_auto_completer
|
||||
self.media_item.update_auto_completer()
|
||||
|
||||
@ -723,7 +724,6 @@ class TestMediaItem(TestCase, TestMixin):
|
||||
self.media_item.settings.layout_style_combo_box.setCurrentIndex.assert_called_once_with(2)
|
||||
self.mocked_settings_instance.setValue.assert_called_once_with('bibles/verse layout style', 2)
|
||||
|
||||
|
||||
def test_on_version_combo_box_index_changed_no_bible(self):
|
||||
"""
|
||||
Test on_version_combo_box_index_changed when there is no main bible.
|
||||
@ -781,7 +781,6 @@ class TestMediaItem(TestCase, TestMixin):
|
||||
self.media_item.style_combo_box.setEnabled.assert_called_once_with(False)
|
||||
self.assertEqual(self.media_item.second_bible, self.mocked_bible_2)
|
||||
|
||||
|
||||
def test_on_second_combo_box_index_changed_single_to_dual_user_abort(self):
|
||||
"""
|
||||
Test on_second_combo_box_index_changed when the user changes from single to dual bible mode, there are search
|
||||
|
Loading…
Reference in New Issue
Block a user