forked from openlp/openlp
parent
de213b0f66
commit
7fda8043f5
@ -182,7 +182,7 @@ class FirstTimeForm(QtGui.QWizard, UiFirstTimeWizard, RegistryProperties):
|
||||
title = translate('OpenLP.FirstTimeWizard', 'Network Error')
|
||||
msg.setText('{} {}'.format(title, err.code if hasattr(err, 'code') else ''))
|
||||
msg.setInformativeText(translate('OpenLP.FirstTimeWizard',
|
||||
'There was a network error attempting to'
|
||||
'There was a network error attempting to '
|
||||
'connect to retrieve initial configuration information'))
|
||||
msg.setStandardButtons(msg.Ok)
|
||||
ans = msg.exec_()
|
||||
|
@ -602,7 +602,7 @@ class BibleImportForm(OpenLPWizard):
|
||||
if bible_type == BibleFormat.WebDownload:
|
||||
self.progress_label.setText(
|
||||
translate('BiblesPlugin.ImportWizardForm', 'Registered Bible. Please note, that verses will be '
|
||||
'downloaded on\ndemand and thus an internet connection is required.'))
|
||||
'downloaded on demand and thus an internet connection is required.'))
|
||||
else:
|
||||
self.progress_label.setText(WizardStrings.FinishedImport)
|
||||
else:
|
||||
|
@ -175,10 +175,32 @@ def update_reference_separators():
|
||||
"""
|
||||
Updates separators and matches for parsing and formating scripture references.
|
||||
"""
|
||||
default_separators = \
|
||||
translate('BiblesPlugin',
|
||||
':|v|V|verse|verses;;-|to;;,|and;;end Double-semicolon delimited separators for parsing references. '
|
||||
'Consult the developers for further information.').split(';;')
|
||||
default_separators = ['|'.join([translate('BiblesPlugin', ':',
|
||||
'Verse identifier e.g. Genisis 1 : 1 = Genisis Chapter 1 Verse 1'),
|
||||
translate('BiblesPlugin', 'v',
|
||||
'Verse identifier e.g. Genisis 1 v 1 = Genisis Chapter 1 Verse 1'),
|
||||
translate('BiblesPlugin', 'V',
|
||||
'Verse identifier e.g. Genisis 1 V 1 = Genisis Chapter 1 Verse 1'),
|
||||
translate('BiblesPlugin', 'verse',
|
||||
'Verse identifier e.g. Genisis 1 verse 1 = Genisis Chapter 1 Verse 1'),
|
||||
translate('BiblesPlugin', 'verses',
|
||||
'Verse identifier e.g. Genisis 1 verses 1 - 2 = '
|
||||
'Genisis Chapter 1 Verses 1 to 2')]),
|
||||
'|'.join([translate('BiblesPlugin', '-',
|
||||
'range identifier e.g. Genisis 1 verse 1 - 2 = '
|
||||
'Genisis Chapter 1 Verses 1 To 2'),
|
||||
translate('BiblesPlugin', 'to',
|
||||
'range identifier e.g. Genisis 1 verse 1 - 2 = '
|
||||
'Genisis Chapter 1 Verses 1 To 2')]),
|
||||
'|'.join([translate('BiblesPlugin', ',',
|
||||
'connecting identifier e.g. Genisis 1 verse 1 - 2, 4 - 5 = '
|
||||
'Genisis Chapter 1 Verses 1 To 2 And Verses 4 To 5'),
|
||||
translate('BiblesPlugin', 'and',
|
||||
'connecting identifier e.g. Genisis 1 verse 1 - 2 and 4 - 5 = '
|
||||
'Genisis Chapter 1 Verses 1 To 2 And Verses 4 To 5')]),
|
||||
'|'.join([translate('BiblesPlugin', 'end',
|
||||
'ending identifier e.g. Genisis 1 verse 1 - end = '
|
||||
'Genisis Chapter 1 Verses 1 To The Last Verse')])]
|
||||
settings = Settings()
|
||||
settings.beginGroup('bibles')
|
||||
custom_separators = [
|
||||
|
@ -24,13 +24,39 @@ This module contains tests for the lib submodule of the Bibles plugin.
|
||||
"""
|
||||
from unittest import TestCase
|
||||
|
||||
from openlp.plugins.bibles import lib
|
||||
from openlp.plugins.bibles.lib import SearchResults
|
||||
from tests.functional import MagicMock, patch
|
||||
|
||||
|
||||
class TestLib(TestCase):
|
||||
"""
|
||||
Test the functions in the :mod:`lib` module.
|
||||
"""
|
||||
def get_reference_separator_test(self):
|
||||
"""
|
||||
Test the get_reference_separator method
|
||||
"""
|
||||
# GIVEN: A list of expected separators
|
||||
separators = {'sep_r': '\\s*(?:e)\\s*', 'sep_e_default': 'end', 'sep_v_display': 'w', 'sep_l_display': 'r',
|
||||
'sep_v_default': ':|v|V|verse|verses', 'sep_l': '\\s*(?:r)\\s*', 'sep_l_default': ',|and',
|
||||
'sep_e': '\\s*(?:t)\\s*', 'sep_v': '\\s*(?:w)\\s*', 'sep_r_display': 'e',
|
||||
'sep_r_default': '-|to'}
|
||||
|
||||
def side_effect():
|
||||
lib.REFERENCE_SEPARATORS = separators
|
||||
|
||||
with patch('openlp.plugins.bibles.lib.update_reference_separators',
|
||||
**{'side_effect': side_effect}) as mocked_update_reference_separators:
|
||||
|
||||
# WHEN: Calling get_reference_separator
|
||||
for key, value in separators.items():
|
||||
ret = lib.get_reference_separator(key)
|
||||
|
||||
# THEN: get_reference_separator should return the correct separator
|
||||
self.assertEqual(separators[key], value)
|
||||
mocked_update_reference_separators.assert_called_once_with()
|
||||
|
||||
def search_results_creation_test(self):
|
||||
"""
|
||||
Test the creation and construction of the SearchResults class
|
||||
|
Loading…
Reference in New Issue
Block a user