openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #22941
[Merge] lp:~trb143/openlp/pep8 into lp:openlp
Tim Bentley has proposed merging lp:~trb143/openlp/pep8 into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~trb143/openlp/pep8/+merge/214333
Fix bug in http server restart
clean up error handling display.
clean up pep8 errors in tests.
We are now 100% clean
--
https://code.launchpad.net/~trb143/openlp/pep8/+merge/214333
Your team OpenLP Core is requested to review the proposed merge of lp:~trb143/openlp/pep8 into lp:openlp.
=== modified file 'openlp/core/common/__init__.py'
--- openlp/core/common/__init__.py 2014-03-17 19:05:55 +0000
+++ openlp/core/common/__init__.py 2014-04-04 20:24:53 +0000
@@ -51,8 +51,10 @@
:param logger: logger to use so traceback is logged to correct class
"""
+ log_string = "OpenLP Error trace"
for tb in traceback.extract_stack():
- logger.error('Called by ' + tb[3] + ' at line ' + str(tb[1]) + ' in ' + tb[0])
+ log_string = '%s\n File %s at line %d \n\t called %s' % (log_string, tb[0], tb[1], tb[3])
+ logger.error(log_string)
def check_directory_exists(directory, do_not_log=False):
=== modified file 'openlp/plugins/bibles/lib/db.py'
--- openlp/plugins/bibles/lib/db.py 2014-03-21 18:23:35 +0000
+++ openlp/plugins/bibles/lib/db.py 2014-04-04 20:24:53 +0000
@@ -561,7 +561,7 @@
Return a book by name or abbreviation.
:param name: The name or abbreviation of the book.
- :param lower: True if the comparsion should be only lowercase
+ :param lower: True if the comparison should be only lowercase
"""
log.debug('BiblesResourcesDB.get_book("%s")', name)
if not isinstance(name, str):
=== modified file 'openlp/plugins/remotes/lib/httpserver.py'
--- openlp/plugins/remotes/lib/httpserver.py 2014-03-21 21:38:08 +0000
+++ openlp/plugins/remotes/lib/httpserver.py 2014-04-04 20:24:53 +0000
@@ -28,15 +28,15 @@
###############################################################################
"""
-The :mod:`http` module contains the API web server. This is a lightweight web
-server used by remotes to interact with OpenLP. It uses JSON to communicate with
-the remotes.
+The :mod:`http` module contains the API web server. This is a lightweight web server used by remotes to interact
+with OpenLP. It uses JSON to communicate with the remotes.
"""
import ssl
import socket
import os
import logging
+import time
from PyQt4 import QtCore
@@ -53,8 +53,8 @@
class CustomHandler(BaseHTTPRequestHandler, HttpRouter):
"""
Stateless session handler to handle the HTTP request and process it.
- This class handles just the overrides to the base methods and the logic to invoke the
- methods within the HttpRouter class.
+ This class handles just the overrides to the base methods and the logic to invoke the methods within the HttpRouter
+ class.
DO not try change the structure as this is as per the documentation.
"""
@@ -116,9 +116,20 @@
log.debug('Started ssl httpd...')
else:
port = Settings().value(self.settings_section + '/port')
- self.httpd = ThreadingHTTPServer((address, port), CustomHandler)
+ loop = 1
+ while loop < 3:
+ try:
+ self.httpd = ThreadingHTTPServer((address, port), CustomHandler)
+ except OSError:
+ loop += 1
+ time.sleep(0.1)
+ except:
+ log.error('Failed to start server ')
log.debug('Started non ssl httpd...')
- self.httpd.serve_forever()
+ if hasattr(self, 'httpd') and self.httpd:
+ self.httpd.serve_forever()
+ else:
+ log.debug('Failed to start server')
def stop_server(self):
"""
=== modified file 'resources/__init__.py'
--- resources/__init__.py 2013-12-24 08:56:50 +0000
+++ resources/__init__.py 2014-04-04 20:24:53 +0000
@@ -32,4 +32,3 @@
DO NOT REMOVE THIS FILE, IT IS REQUIRED FOR INCLUDING THE RESOURCES ON SOME
PLATFORMS!
"""
-
=== modified file 'scripts/translation_utils.py'
--- scripts/translation_utils.py 2013-12-24 08:56:50 +0000
+++ scripts/translation_utils.py 2014-04-04 20:24:53 +0000
@@ -52,7 +52,9 @@
"""
import os
-import urllib.request, urllib.error, urllib.parse
+import urllib.request
+import urllib.error
+import urllib.parse
from getpass import getpass
import base64
import json
@@ -70,6 +72,7 @@
username = ''
password = ''
+
class Command(object):
"""
Provide an enumeration of commands.
@@ -80,6 +83,7 @@
Update = 4
Generate = 5
+
class CommandStack(object):
"""
This class provides an iterable stack.
@@ -134,13 +138,13 @@
results.append(str((item['command'], )))
return '[%s]' % ', '.join(results)
+
def print_quiet(text, linefeed=True):
"""
- This method checks to see if we are in quiet mode, and if not prints
- ``text`` out.
+ This method checks to see if we are in quiet mode, and if not prints ``text`` out.
- ``text``
- The text to print.
+ :param text: The text to print.
+ :param linefeed: Linefeed required
"""
global quiet_mode
if not quiet_mode:
@@ -149,33 +153,33 @@
else:
print(text, end=' ')
+
def print_verbose(text):
"""
- This method checks to see if we are in verbose mode, and if so prints
- ``text`` out.
+ This method checks to see if we are in verbose mode, and if so prints ``text`` out.
- ``text``
- The text to print.
+ :param text: The text to print.
"""
global verbose_mode, quiet_mode
if not quiet_mode and verbose_mode:
print(' %s' % text)
+
def run(command):
"""
This method runs an external application.
- ``command``
- The command to run.
+ :param command: The command to run.
"""
print_verbose(command)
process = QtCore.QProcess()
process.start(command)
- while (process.waitForReadyRead()):
+ while process.waitForReadyRead():
print_verbose('ReadyRead: %s' % QtCore.QString(process.readAll()))
print_verbose('Error(s):\n%s' % process.readAllStandardError())
print_verbose('Output:\n%s' % process.readAllStandardOutput())
+
def download_translations():
"""
This method downloads the translation files from the Pootle server.
@@ -190,9 +194,8 @@
password = getpass(' Transifex password: ')
# First get the list of languages
url = SERVER_URL + 'resource/ents/'
- base64string = base64.encodestring(
- '%s:%s' % (username, password))[:-1]
- auth_header = 'Basic %s' % base64string
+ base64string = base64.encodbytes('%s:%s' % (username, password))[:-1]
+ auth_header = 'Basic %s' % base64string
request = urllib.request.Request(url + '?details')
request.add_header('Authorization', auth_header)
print_verbose('Downloading list of languages from: %s' % url)
@@ -207,8 +210,7 @@
lang_url = url + 'translation/%s/?file' % language
request = urllib.request.Request(lang_url)
request.add_header('Authorization', auth_header)
- filename = os.path.join(os.path.abspath('..'), 'resources', 'i18n',
- language + '.ts')
+ filename = os.path.join(os.path.abspath('..'), 'resources', 'i18n', language + '.ts')
print_verbose('Get Translation File: %s' % filename)
response = urllib.request.urlopen(request)
fd = open(filename, 'w')
@@ -217,10 +219,10 @@
print_quiet(' Done.')
return True
+
def prepare_project():
"""
- This method creates the project file needed to update the translation files
- and compile them into .qm files.
+ This method creates the project file needed to update the translation files and compile them into .qm files.
"""
print_quiet('Generating the openlp.pro file')
lines = []
@@ -229,9 +231,9 @@
print_verbose('Starting directory: %s' % start_dir)
for root, dirs, files in os.walk(start_dir):
for file in files:
- path = root.replace(start_dir, '').replace('\\', '/') #.replace(u'..', u'.')
+ path = root.replace(start_dir, '').replace('\\', '/')
if file.startswith('hook-') or file.startswith('test_'):
- continue
+ continue
ignore = False
for ignored_path in IGNORED_PATHS:
if path.startswith(ignored_path):
@@ -263,6 +265,7 @@
file.close()
print_quiet(' Done.')
+
def update_translations():
print_quiet('Update the translation files')
if not os.path.exists(os.path.join(os.path.abspath('..'), 'openlp.pro')):
@@ -273,11 +276,12 @@
run('pylupdate4 -verbose -noobsolete openlp.pro')
os.chdir(os.path.abspath('scripts'))
+
def generate_binaries():
print_quiet('Generate the related *.qm files')
if not os.path.exists(os.path.join(os.path.abspath('..'), 'openlp.pro')):
print('You have not generated a project file yet, please run this script with the -p option. It is also ' +
- 'recommended that you this script with the -u option to update the translation files as well.')
+ 'recommended that you this script with the -u option to update the translation files as well.')
return
else:
os.chdir(os.path.abspath('..'))
@@ -290,12 +294,11 @@
This method opens a browser to the OpenLP project page at Transifex so
that the user can request a new language.
"""
- print_quiet('Please request a new language at the OpenLP project on '
- 'Transifex.')
- webbrowser.open('https://www.transifex.net/projects/p/openlp/'
- 'resource/ents/')
+ print_quiet('Please request a new language at the OpenLP project on Transifex.')
+ webbrowser.open('https://www.transifex.net/projects/p/openlp/resource/ents/')
print_quiet('Opening browser to OpenLP project...')
+
def process_stack(command_stack):
"""
This method looks at the commands in the command stack, and processes them
@@ -323,6 +326,7 @@
else:
print_quiet('No commands to process.')
+
def main():
global verbose_mode, quiet_mode, username, password
# Set up command line options.
@@ -331,23 +335,23 @@
'This script is used to manage OpenLP\'s translation files.'
parser = OptionParser(usage=usage)
parser.add_option('-U', '--username', dest='username', metavar='USERNAME',
- help='Transifex username, used for authentication')
+ help='Transifex username, used for authentication')
parser.add_option('-P', '--password', dest='password', metavar='PASSWORD',
- help='Transifex password, used for authentication')
+ help='Transifex password, used for authentication')
parser.add_option('-d', '--download-ts', dest='download',
- action='store_true', help='download language files from Transifex')
+ action='store_true', help='download language files from Transifex')
parser.add_option('-c', '--create', dest='create', action='store_true',
- help='go to Transifex to request a new translation file')
+ help='go to Transifex to request a new translation file')
parser.add_option('-p', '--prepare', dest='prepare', action='store_true',
- help='generate a project file, used to update the translations')
+ help='generate a project file, used to update the translations')
parser.add_option('-u', '--update', action='store_true', dest='update',
- help='update translation files (needs a project file)')
+ help='update translation files (needs a project file)')
parser.add_option('-g', '--generate', dest='generate', action='store_true',
- help='compile .ts files into .qm files')
+ help='compile .ts files into .qm files')
parser.add_option('-v', '--verbose', dest='verbose', action='store_true',
- help='show extra information while processing translations')
+ help='show extra information while processing translations')
parser.add_option('-q', '--quiet', dest='quiet', action='store_true',
- help='suppress all output other than errors')
+ help='suppress all output other than errors')
(options, args) = parser.parse_args()
# Create and populate the command stack
command_stack = CommandStack()
=== modified file 'setup.py'
--- setup.py 2014-03-17 19:05:55 +0000
+++ setup.py 2014-04-04 20:24:53 +0000
@@ -106,9 +106,9 @@
# If they are equal, then this tree is tarball with the source for the release. We do not want the revision number
# in the version string.
if tree_revision == tag_revision:
- version_string = tag_version
+ version_string = tag_version
else:
- version_string = '%s-bzr%s' % (tag_version, tree_revision)
+ version_string = '%s-bzr%s' % (tag_version, tree_revision)
ver_file = open(VERSION_FILE, 'w')
ver_file.write(version_string)
except:
@@ -123,7 +123,9 @@
version=version_string,
description="Open source Church presentation and lyrics projection application.",
long_description="""\
-OpenLP (previously openlp.org) is free church presentation software, or lyrics projection software, used to display slides of songs, Bible verses, videos, images, and even presentations (if PowerPoint is installed) for church worship using a computer and a data projector.""",
+OpenLP (previously openlp.org) is free church presentation software, or lyrics projection software, used to display
+slides of songs, Bible verses, videos, images, and even presentations (if PowerPoint is installed) for church worship
+using a computer and a data projector.""",
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: MacOS X',
@@ -158,7 +160,7 @@
'Topic :: Multimedia :: Sound/Audio',
'Topic :: Multimedia :: Video',
'Topic :: Religion'
- ], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
+ ], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
keywords='open source church presentation lyrics projection song bible display project',
author='Raoul Snyman',
author_email='raoulsnyman@xxxxxxxxxx',
=== modified file 'tests/functional/openlp_core_common/test_applocation.py'
--- tests/functional/openlp_core_common/test_applocation.py 2014-03-13 20:59:10 +0000
+++ tests/functional/openlp_core_common/test_applocation.py 2014-04-04 20:24:53 +0000
@@ -54,9 +54,9 @@
# GIVEN: A mocked out Settings class and a mocked out AppLocation.get_directory()
mocked_settings = mocked_class.return_value
mocked_settings.contains.return_value = False
- mocked_get_directory.return_value = os.path.join('test','dir')
+ mocked_get_directory.return_value = os.path.join('test', 'dir')
mocked_check_directory_exists.return_value = True
- mocked_os.path.normpath.return_value = os.path.join('test','dir')
+ mocked_os.path.normpath.return_value = os.path.join('test', 'dir')
# WHEN: we call AppLocation.get_data_path()
data_path = AppLocation.get_data_path()
@@ -64,8 +64,8 @@
# THEN: check that all the correct methods were called, and the result is correct
mocked_settings.contains.assert_called_with('advanced/data path')
mocked_get_directory.assert_called_with(AppLocation.DataDir)
- mocked_check_directory_exists.assert_called_with(os.path.join('test','dir'))
- self.assertEqual(os.path.join('test','dir'), data_path, 'Result should be "test/dir"')
+ mocked_check_directory_exists.assert_called_with(os.path.join('test', 'dir'))
+ self.assertEqual(os.path.join('test', 'dir'), data_path, 'Result should be "test/dir"')
def get_data_path_with_custom_location_test(self):
"""
@@ -110,14 +110,14 @@
with patch('openlp.core.common.AppLocation.get_data_path') as mocked_get_data_path, \
patch('openlp.core.common.applocation.os.listdir') as mocked_listdir:
# GIVEN: Our mocked modules/methods.
- mocked_get_data_path.return_value = os.path.join('test','dir')
+ mocked_get_data_path.return_value = os.path.join('test', 'dir')
mocked_listdir.return_value = copy.deepcopy(FILE_LIST)
# When: Get the list of files.
result = AppLocation.get_files('section', '.mp3')
# Then: Check if the section parameter was used correctly.
- mocked_listdir.assert_called_with(os.path.join('test','dir','section'))
+ mocked_listdir.assert_called_with(os.path.join('test', 'dir', 'section'))
# Then: check if the file lists are identical.
self.assertListEqual(['file5.mp3', 'file6.mp3'], result, 'The file lists should be identical.')
@@ -129,15 +129,15 @@
with patch('openlp.core.common.AppLocation.get_data_path') as mocked_get_data_path, \
patch('openlp.core.common.applocation.check_directory_exists') as mocked_check_directory_exists:
# GIVEN: A mocked out AppLocation.get_data_path()
- mocked_get_data_path.return_value = os.path.join('test','dir')
+ mocked_get_data_path.return_value = os.path.join('test', 'dir')
mocked_check_directory_exists.return_value = True
# WHEN: we call AppLocation.get_data_path()
data_path = AppLocation.get_section_data_path('section')
# THEN: check that all the correct methods were called, and the result is correct
- mocked_check_directory_exists.assert_called_with(os.path.join('test','dir','section'))
- self.assertEqual(os.path.join('test','dir','section'), data_path, 'Result should be "test/dir/section"')
+ mocked_check_directory_exists.assert_called_with(os.path.join('test', 'dir', 'section'))
+ self.assertEqual(os.path.join('test', 'dir', 'section'), data_path, 'Result should be "test/dir/section"')
def get_directory_for_app_dir_test(self):
"""
@@ -145,13 +145,13 @@
"""
# GIVEN: A mocked out _get_frozen_path function
with patch('openlp.core.common.applocation.get_frozen_path') as mocked_get_frozen_path:
- mocked_get_frozen_path.return_value = os.path.join('app','dir')
+ mocked_get_frozen_path.return_value = os.path.join('app', 'dir')
# WHEN: We call AppLocation.get_directory
directory = AppLocation.get_directory(AppLocation.AppDir)
# THEN: check that the correct directory is returned
- self.assertEqual(os.path.join('app','dir'), directory, 'Directory should be "app/dir"')
+ self.assertEqual(os.path.join('app', 'dir'), directory, 'Directory should be "app/dir"')
def get_directory_for_plugins_dir_test(self):
"""
=== modified file 'tests/functional/openlp_core_common/test_registry.py'
--- tests/functional/openlp_core_common/test_registry.py 2014-03-31 17:01:09 +0000
+++ tests/functional/openlp_core_common/test_registry.py 2014-04-04 20:24:53 +0000
@@ -119,4 +119,3 @@
def dummy_function_2(self):
return "function_2"
-
=== modified file 'tests/functional/openlp_core_common/test_registryproperties.py'
--- tests/functional/openlp_core_common/test_registryproperties.py 2014-03-14 22:08:44 +0000
+++ tests/functional/openlp_core_common/test_registryproperties.py 2014-04-04 20:24:53 +0000
@@ -63,4 +63,4 @@
# WHEN the application is registered
Registry().register('application', application)
# THEN the application should be none
- self.assertEquals(self.application, application, 'The application value should match')
\ No newline at end of file
+ self.assertEquals(self.application, application, 'The application value should match')
=== modified file 'tests/functional/openlp_core_common/test_uistrings.py'
--- tests/functional/openlp_core_common/test_uistrings.py 2013-12-24 08:56:50 +0000
+++ tests/functional/openlp_core_common/test_uistrings.py 2014-04-04 20:24:53 +0000
@@ -46,5 +46,3 @@
# THEN: Check if the instances are the same.
self.assertIs(first_instance, second_instance, 'Two UiStrings objects should be the same instance')
-
-
=== modified file 'tests/functional/openlp_core_lib/__init__.py'
--- tests/functional/openlp_core_lib/__init__.py 2014-03-14 22:08:44 +0000
+++ tests/functional/openlp_core_lib/__init__.py 2014-04-04 20:24:53 +0000
@@ -28,4 +28,4 @@
###############################################################################
"""
Package to test the openlp.core.lib package.
-"""
\ No newline at end of file
+"""
=== modified file 'tests/functional/openlp_core_lib/test_db.py'
--- tests/functional/openlp_core_lib/test_db.py 2014-03-18 21:03:53 +0000
+++ tests/functional/openlp_core_lib/test_db.py 2014-04-04 20:24:53 +0000
@@ -52,7 +52,7 @@
with patch('openlp.core.lib.db.create_engine') as mocked_create_engine, \
patch('openlp.core.lib.db.MetaData') as MockedMetaData, \
patch('openlp.core.lib.db.sessionmaker') as mocked_sessionmaker, \
- patch('openlp.core.lib.db.scoped_session') as mocked_scoped_session:
+ patch('openlp.core.lib.db.scoped_session') as mocked_scoped_session:
mocked_engine = MagicMock()
mocked_metadata = MagicMock()
mocked_sessionmaker_object = MagicMock()
=== modified file 'tests/functional/openlp_core_lib/test_file_dialog.py'
--- tests/functional/openlp_core_lib/test_file_dialog.py 2014-03-14 22:08:44 +0000
+++ tests/functional/openlp_core_lib/test_file_dialog.py 2014-04-04 20:24:53 +0000
@@ -42,7 +42,8 @@
# THEN: The returned value should be an empty QStringList and os.path.exists should not have been called
assert not self.mocked_os.path.exists.called
self.assertEqual(result, [],
- 'FileDialog.getOpenFileNames should return and empty list when QFileDialog.getOpenFileNames is canceled')
+ 'FileDialog.getOpenFileNames should return and empty list when QFileDialog.getOpenFileNames '
+ 'is canceled')
def returned_file_list_test(self):
"""
@@ -70,5 +71,5 @@
self.mocked_os.path.exists.assert_callde_with('/non-existing')
self.mocked_os.path.exists.assert_callde_with('/non-existing')
self.mocked_qt_gui.QmessageBox.information.called_with(self.mocked_parent, UiStrings().FileNotFound,
- UiStrings().FileNotFoundMessage % '/non-existing')
- self.assertEqual(result, ['/Valid File', '/url encoded file #1'], 'The returned file list is incorrect')
\ No newline at end of file
+ UiStrings().FileNotFoundMessage % '/non-existing')
+ self.assertEqual(result, ['/Valid File', '/url encoded file #1'], 'The returned file list is incorrect')
=== modified file 'tests/functional/openlp_core_lib/test_formattingtags.py'
--- tests/functional/openlp_core_lib/test_formattingtags.py 2013-12-24 08:56:50 +0000
+++ tests/functional/openlp_core_lib/test_formattingtags.py 2014-04-04 20:24:53 +0000
@@ -108,4 +108,3 @@
# THEN: The lists should now be identical.
assert old_tags_list == FormattingTags.get_html_tags(), 'The lists should be identical.'
-
=== modified file 'tests/functional/openlp_core_lib/test_htmlbuilder.py'
--- tests/functional/openlp_core_lib/test_htmlbuilder.py 2013-12-26 08:56:53 +0000
+++ tests/functional/openlp_core_lib/test_htmlbuilder.py 2014-04-04 20:24:53 +0000
@@ -321,4 +321,3 @@
# THEN: THE css should be the same.
assert FOOTER_CSS == css, 'The footer strings should be equal.'
-
=== modified file 'tests/functional/openlp_core_lib/test_lib.py'
--- tests/functional/openlp_core_lib/test_lib.py 2013-12-24 08:56:50 +0000
+++ tests/functional/openlp_core_lib/test_lib.py 2014-04-04 20:24:53 +0000
@@ -311,8 +311,8 @@
mocked_buffer.open.assert_called_with('writeonly')
mocked_image.save.assert_called_with(mocked_buffer, "PNG")
mocked_byte_array.toBase64.assert_called_with()
- self.assertEqual('base64mock', result,
- 'The result should be the return value of the mocked out base64 method')
+ self.assertEqual('base64mock', result, 'The result should be the return value of the mocked out '
+ 'base64 method')
def create_thumb_with_size_test(self):
"""
=== modified file 'tests/functional/openlp_core_lib/test_renderer.py'
--- tests/functional/openlp_core_lib/test_renderer.py 2014-01-11 19:31:06 +0000
+++ tests/functional/openlp_core_lib/test_renderer.py 2014-04-04 20:24:53 +0000
@@ -86,4 +86,4 @@
self.assertEqual(renderer.width, 1024, 'The base renderer should be a live controller')
self.assertEqual(renderer.height, 768, 'The base renderer should be a live controller')
self.assertEqual(renderer.screen_ratio, 0.75, 'The base renderer should be a live controller')
- self.assertEqual(renderer.footer_start, 691, 'The base renderer should be a live controller')
\ No newline at end of file
+ self.assertEqual(renderer.footer_start, 691, 'The base renderer should be a live controller')
=== modified file 'tests/functional/openlp_core_lib/test_theme.py'
--- tests/functional/openlp_core_lib/test_theme.py 2013-12-24 08:56:50 +0000
+++ tests/functional/openlp_core_lib/test_theme.py 2014-04-04 20:24:53 +0000
@@ -69,4 +69,3 @@
'The theme should have a font_footer_name of Arial')
self.assertTrue(default_theme.font_main_bold is False, 'The theme should have a font_main_bold of false')
self.assertTrue(len(default_theme.__dict__) == 47, 'The theme should have 47 variables')
-
=== modified file 'tests/functional/openlp_core_ui/test_formattingtagscontroller.py'
--- tests/functional/openlp_core_ui/test_formattingtagscontroller.py 2014-01-04 11:50:27 +0000
+++ tests/functional/openlp_core_ui/test_formattingtagscontroller.py 2014-04-04 20:24:53 +0000
@@ -72,9 +72,10 @@
# THEN: The result should match the predetermined value.
self.assertTrue(result == test['gen'],
- 'Function should handle end tag correctly : %s and %s for %s ' % (test['gen'], result, test['start']))
- self.assertTrue(error == test['valid'],
- 'Function should not generate unexpected error messages : %s ' % error)
+ 'Function should handle end tag correctly : %s and %s for %s ' %
+ (test['gen'], result, test['start']))
+ self.assertTrue(error == test['valid'], 'Function should not generate unexpected error messages : %s ' %
+ error)
def test_start_tag_changed_processes_correctly(self):
"""
@@ -94,10 +95,10 @@
error, result = self.services.start_tag_changed(test['start'], test['end'])
# THEN: The result should match the predetermined value.
- self.assertTrue(result == test['gen'],
- 'Function should handle end tag correctly : %s and %s ' % (test['gen'], result))
- self.assertTrue(error == test['valid'],
- 'Function should not generate unexpected error messages : %s ' % error)
+ self.assertTrue(result == test['gen'], 'Function should handle end tag correctly : %s and %s ' %
+ (test['gen'], result))
+ self.assertTrue(error == test['valid'], 'Function should not generate unexpected error messages : %s ' %
+ error)
def test_start_html_to_end_html(self):
"""
@@ -112,5 +113,5 @@
result = self.services.start_html_to_end_html(test1)
# THEN: The result should match the predetermined value.
- self.assertTrue(result == test2, 'Calculated end tag should be valid: %s and %s = %s'
- % (test1, test2, result))
\ No newline at end of file
+ self.assertTrue(result == test2, 'Calculated end tag should be valid: %s and %s = %s' %
+ (test1, test2, result))
=== modified file 'tests/functional/openlp_core_ui/test_formattingtagsform.py'
--- tests/functional/openlp_core_ui/test_formattingtagsform.py 2014-01-04 11:50:27 +0000
+++ tests/functional/openlp_core_ui/test_formattingtagsform.py 2014-04-04 20:24:53 +0000
@@ -74,4 +74,3 @@
# THEN: setEnabled and setDefault should have been called on save_push_button
#form.save_button.setEnabled.assert_called_with(True)
-
=== modified file 'tests/functional/openlp_core_ui/test_servicemanager.py'
--- tests/functional/openlp_core_ui/test_servicemanager.py 2014-01-11 19:31:06 +0000
+++ tests/functional/openlp_core_ui/test_servicemanager.py 2014-04-04 20:24:53 +0000
@@ -74,4 +74,4 @@
# THEN: The the controller should be registered in the registry.
self.assertNotEqual(service, None, 'The base service should be created')
self.assertEqual(service['openlp_core']['service-theme'], 'test_theme', 'The test theme should be saved')
- self.assertEqual(service['openlp_core']['lite-service'], False, 'The lite service should be saved')
\ No newline at end of file
+ self.assertEqual(service['openlp_core']['lite-service'], False, 'The lite service should be saved')
=== modified file 'tests/functional/openlp_core_utils/__init__.py'
--- tests/functional/openlp_core_utils/__init__.py 2014-03-14 22:08:44 +0000
+++ tests/functional/openlp_core_utils/__init__.py 2014-04-04 20:24:53 +0000
@@ -25,4 +25,4 @@
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
-###############################################################################
\ No newline at end of file
+###############################################################################
=== modified file 'tests/functional/openlp_core_utils/test_actions.py'
--- tests/functional/openlp_core_utils/test_actions.py 2014-03-14 22:08:44 +0000
+++ tests/functional/openlp_core_utils/test_actions.py 2014-04-04 20:24:53 +0000
@@ -149,5 +149,3 @@
# THEN: Both action should keep their shortcuts.
assert len(action3.shortcuts()) == 2, 'The action should have two shortcut assigned.'
assert len(action_with_same_shortcuts3.shortcuts()) == 2, 'The action should have two shortcuts assigned.'
-
-
=== modified file 'tests/functional/openlp_core_utils/test_utils.py'
--- tests/functional/openlp_core_utils/test_utils.py 2014-03-13 20:59:10 +0000
+++ tests/functional/openlp_core_utils/test_utils.py 2014-04-04 20:24:53 +0000
@@ -107,7 +107,7 @@
"""
# GIVEN: sys.getfilesystemencoding returns "cp1252"
with patch('openlp.core.utils.sys.getfilesystemencoding') as mocked_getfilesystemencoding, \
- patch('openlp.core.utils.sys.getdefaultencoding') as mocked_getdefaultencoding:
+ patch('openlp.core.utils.sys.getdefaultencoding') as mocked_getdefaultencoding:
mocked_getfilesystemencoding.return_value = 'cp1252'
# WHEN: get_filesystem_encoding() is called
@@ -124,7 +124,7 @@
"""
# GIVEN: sys.getfilesystemencoding returns None and sys.getdefaultencoding returns "utf-8"
with patch('openlp.core.utils.sys.getfilesystemencoding') as mocked_getfilesystemencoding, \
- patch('openlp.core.utils.sys.getdefaultencoding') as mocked_getdefaultencoding:
+ patch('openlp.core.utils.sys.getdefaultencoding') as mocked_getdefaultencoding:
mocked_getfilesystemencoding.return_value = None
mocked_getdefaultencoding.return_value = 'utf-8'
@@ -175,7 +175,7 @@
# THEN: A tuple should be returned.
self.assertEqual(wanted_result, result,
- 'A two-entry tuple with the directory and file name (empty) should have been returned.')
+ 'A two-entry tuple with the directory and file name (empty) should have been returned.')
def clean_filename_test(self):
"""
@@ -206,7 +206,7 @@
# THEN: We get a properly sorted list
self.assertEqual(['Aushang', '\u00C4u\u00DFerung', 'Auszug'], sorted_list,
- 'Strings should be sorted properly')
+ 'Strings should be sorted properly')
def get_natural_key_test(self):
"""
=== modified file 'tests/functional/openlp_plugins/bibles/__init__.py'
--- tests/functional/openlp_plugins/bibles/__init__.py 2014-03-17 07:14:51 +0000
+++ tests/functional/openlp_plugins/bibles/__init__.py 2014-04-04 20:24:53 +0000
@@ -26,4 +26,3 @@
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
-
=== modified file 'tests/functional/openlp_plugins/bibles/test_http.py'
--- tests/functional/openlp_plugins/bibles/test_http.py 2014-03-14 22:08:44 +0000
+++ tests/functional/openlp_plugins/bibles/test_http.py 2014-04-04 20:24:53 +0000
@@ -116,7 +116,8 @@
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')
+ 'BSExtract.get_books_from_http should return None when get_soup_for_bible_ref returns a '
+ 'false value')
def get_books_from_http_no_content_test(self):
"""
@@ -146,7 +147,8 @@
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')
+ 'BSExtract.get_books_from_http should return None when get_soup_for_bible_ref returns a '
+ 'false value')
def get_books_from_http_content_test(self):
"""
=== modified file 'tests/functional/openlp_plugins/bibles/test_lib.py'
--- tests/functional/openlp_plugins/bibles/test_lib.py 2014-03-11 20:10:46 +0000
+++ tests/functional/openlp_plugins/bibles/test_lib.py 2014-04-04 20:24:53 +0000
@@ -85,5 +85,3 @@
# THEN: It should be False
self.assertFalse(has_verse_list, 'The SearchResults object should have a verse list')
-
-
=== modified file 'tests/functional/openlp_plugins/images/__init__.py'
--- tests/functional/openlp_plugins/images/__init__.py 2014-03-14 22:08:44 +0000
+++ tests/functional/openlp_plugins/images/__init__.py 2014-04-04 20:24:53 +0000
@@ -25,4 +25,4 @@
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
-###############################################################################
\ No newline at end of file
+###############################################################################
=== modified file 'tests/functional/openlp_plugins/images/test_lib.py'
--- tests/functional/openlp_plugins/images/test_lib.py 2013-12-28 21:33:38 +0000
+++ tests/functional/openlp_plugins/images/test_lib.py 2014-04-04 20:24:53 +0000
@@ -108,7 +108,7 @@
Test that the save_new_images_list() saves all images in the list
"""
# GIVEN: A list with 3 images
- image_list = [ 'test_image_1.jpg', 'test_image_2.jpg', 'test_image_3.jpg' ]
+ image_list = ['test_image_1.jpg', 'test_image_2.jpg', 'test_image_3.jpg']
with patch('openlp.plugins.images.lib.mediaitem.ImageMediaItem.load_full_list') as mocked_load_full_list:
self.media_item.manager = MagicMock()
@@ -124,7 +124,7 @@
Test that the save_new_images_list() ignores everything in the provided list except strings
"""
# GIVEN: A list with images and objects
- image_list = [ 'test_image_1.jpg', None, True, ImageFilenames(), 'test_image_2.jpg' ]
+ image_list = ['test_image_1.jpg', None, True, ImageFilenames(), 'test_image_2.jpg']
with patch('openlp.plugins.images.lib.mediaitem.ImageMediaItem.load_full_list') as mocked_load_full_list:
self.media_item.manager = MagicMock()
@@ -171,7 +171,7 @@
assert self.media_item.manager.delete_object.call_count == 7, \
'manager.delete_object() should be called exactly 7 times'
- # CLEANUP: Remove added attribute from ImageFilenames and ImageGroups
+ # CLEANUP: Remove added attribute from Image Filenames and ImageGroups
delattr(ImageFilenames, 'group_id')
delattr(ImageGroups, 'parent_id')
=== modified file 'tests/functional/openlp_plugins/presentations/__init__.py'
--- tests/functional/openlp_plugins/presentations/__init__.py 2014-03-14 22:08:44 +0000
+++ tests/functional/openlp_plugins/presentations/__init__.py 2014-04-04 20:24:53 +0000
@@ -25,4 +25,4 @@
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
-###############################################################################
\ No newline at end of file
+###############################################################################
=== modified file 'tests/functional/openlp_plugins/presentations/test_pdfcontroller.py'
--- tests/functional/openlp_plugins/presentations/test_pdfcontroller.py 2014-04-03 20:22:10 +0000
+++ tests/functional/openlp_plugins/presentations/test_pdfcontroller.py 2014-04-04 20:24:53 +0000
@@ -52,6 +52,7 @@
'size': QtCore.QRect(0, 0, 1024, 768)
}
+
class TestPdfController(TestCase, TestMixin):
"""
Test the PdfController.
@@ -83,7 +84,6 @@
shutil.rmtree(self.thumbnail_folder)
shutil.rmtree(self.temp_folder)
-
def constructor_test(self):
"""
Test the Constructor from the PdfController
=== modified file 'tests/functional/openlp_plugins/presentations/test_pptviewcontroller.py'
--- tests/functional/openlp_plugins/presentations/test_pptviewcontroller.py 2014-03-24 16:49:50 +0000
+++ tests/functional/openlp_plugins/presentations/test_pptviewcontroller.py 2014-04-04 20:24:53 +0000
@@ -80,7 +80,8 @@
controller = PptviewController(plugin=self.mock_plugin)
# THEN: The name of the presentation controller should be correct
- self.assertEqual('Powerpoint Viewer', controller.name, 'The name of the presentation controller should be correct')
+ self.assertEqual('Powerpoint Viewer', controller.name,
+ 'The name of the presentation controller should be correct')
def check_available_test(self):
"""
@@ -98,9 +99,9 @@
# THEN: On windows it should return True, on other platforms False
if os.name == 'nt':
- self.assertTrue(available, 'check_available should return True on windows.')
+ self.assertTrue(available, 'check_available should return True on windows.')
else:
- self.assertFalse(available, 'check_available should return False when not on windows.')
+ self.assertFalse(available, 'check_available should return False when not on windows.')
class TestPptviewDocument(TestCase):
=== modified file 'tests/functional/openlp_plugins/remotes/__init__.py'
--- tests/functional/openlp_plugins/remotes/__init__.py 2014-03-14 22:08:44 +0000
+++ tests/functional/openlp_plugins/remotes/__init__.py 2014-04-04 20:24:53 +0000
@@ -25,4 +25,4 @@
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
-###############################################################################
\ No newline at end of file
+###############################################################################
=== modified file 'tests/functional/openlp_plugins/remotes/test_router.py'
--- tests/functional/openlp_plugins/remotes/test_router.py 2014-03-14 22:08:44 +0000
+++ tests/functional/openlp_plugins/remotes/test_router.py 2014-04-04 20:24:53 +0000
@@ -111,7 +111,8 @@
Test the get_content_type logic
"""
# GIVEN: a set of files and their corresponding types
- headers = [ ['test.html', 'text/html'], ['test.css', 'text/css'],
+ headers = [
+ ['test.html', 'text/html'], ['test.css', 'text/css'],
['test.js', 'application/javascript'], ['test.jpg', 'image/jpeg'],
['test.gif', 'image/gif'], ['test.ico', 'image/x-icon'],
['test.png', 'image/png'], ['test.whatever', 'text/plain'],
@@ -142,7 +143,7 @@
# THEN: it should return a 404
self.router.send_response.assert_called_once_with(404)
- self.router.send_header.assert_called_once_with('Content-type','text/html')
+ self.router.send_header.assert_called_once_with('Content-type', 'text/html')
self.assertEqual(self.router.end_headers.call_count, 1, 'end_headers called once')
def serve_file_with_valid_params_test(self):
=== modified file 'tests/functional/openlp_plugins/songs/test_ewimport.py'
--- tests/functional/openlp_plugins/songs/test_ewimport.py 2014-03-29 13:31:28 +0000
+++ tests/functional/openlp_plugins/songs/test_ewimport.py 2014-04-04 20:24:53 +0000
@@ -41,33 +41,33 @@
os.path.join(os.path.dirname(__file__), '..', '..', '..', 'resources', 'easyworshipsongs'))
SONG_TEST_DATA = [
{'title': 'Amazing Grace',
- 'authors': ['John Newton'],
- 'copyright': 'Public Domain',
- 'ccli_number': 0,
- 'verses':
- [('Amazing grace how sweet the sound,\nThat saved a wretch like me;\n'
- 'I once was lost, but now am found\nWas blind, but now I see.', 'v1'),
- ('T\'was grace that taught my heart to fear,\nAnd grace my fears relieved;\n'
- 'How precious did that grace appear\nThe hour I first believed.', 'v2'),
- ('Through many dangers, toil and snares,\nI have already come;\n'
- '\'Tis grace has brought me safe thus far,\nAnd grace will lead me home.', 'v3'),
- ('When we\'ve been there ten thousand years\nBright shining as the sun,\n'
- 'We\'ve no less days to sing God\'s praise\nThan when we\'ve first begun.', 'v4')],
- 'verse_order_list': []},
+ 'authors': ['John Newton'],
+ 'copyright': 'Public Domain',
+ 'ccli_number': 0,
+ 'verses':
+ [('Amazing grace how sweet the sound,\nThat saved a wretch like me;\n'
+ 'I once was lost, but now am found\nWas blind, but now I see.', 'v1'),
+ ('T\'was grace that taught my heart to fear,\nAnd grace my fears relieved;\n'
+ 'How precious did that grace appear\nThe hour I first believed.', 'v2'),
+ ('Through many dangers, toil and snares,\nI have already come;\n'
+ '\'Tis grace has brought me safe thus far,\nAnd grace will lead me home.', 'v3'),
+ ('When we\'ve been there ten thousand years\nBright shining as the sun,\n'
+ 'We\'ve no less days to sing God\'s praise\nThan when we\'ve first begun.', 'v4')],
+ 'verse_order_list': []},
{'title': 'Beautiful Garden Of Prayer',
- 'authors': ['Eleanor Allen Schroll James H. Fillmore'],
- 'copyright': 'Public Domain',
- 'ccli_number': 0,
- 'verses':
- [('O the beautiful garden, the garden of prayer,\nO the beautiful garden of prayer.\n'
- 'There my Savior awaits, and He opens the gates\nTo the beautiful garden of prayer.', 'c1'),
- ('There\'s a garden where Jesus is waiting,\nThere\'s a place that is wondrously fair.\n'
- 'For it glows with the light of His presence,\n\'Tis the beautiful garden of prayer.', 'v1'),
- ('There\'s a garden where Jesus is waiting,\nAnd I go with my burden and care.\n'
- 'Just to learn from His lips, words of comfort,\nIn the beautiful garden of prayer.', 'v2'),
- ('There\'s a garden where Jesus is waiting,\nAnd He bids you to come meet Him there,\n'
- 'Just to bow and receive a new blessing,\nIn the beautiful garden of prayer.', 'v3')],
- 'verse_order_list': []}]
+ 'authors': ['Eleanor Allen Schroll James H. Fillmore'],
+ 'copyright': 'Public Domain',
+ 'ccli_number': 0,
+ 'verses':
+ [('O the beautiful garden, the garden of prayer,\nO the beautiful garden of prayer.\n'
+ 'There my Savior awaits, and He opens the gates\nTo the beautiful garden of prayer.', 'c1'),
+ ('There\'s a garden where Jesus is waiting,\nThere\'s a place that is wondrously fair.\n'
+ 'For it glows with the light of His presence,\n\'Tis the beautiful garden of prayer.', 'v1'),
+ ('There\'s a garden where Jesus is waiting,\nAnd I go with my burden and care.\n'
+ 'Just to learn from His lips, words of comfort,\nIn the beautiful garden of prayer.', 'v2'),
+ ('There\'s a garden where Jesus is waiting,\nAnd He bids you to come meet Him there,\n'
+ 'Just to bow and receive a new blessing,\nIn the beautiful garden of prayer.', 'v3')],
+ 'verse_order_list': []}]
class EasyWorshipSongImportLogger(EasyWorshipSongImport):
@@ -95,26 +95,32 @@
self.size = size
TEST_DATA_ENCODING = 'cp1252'
-CODE_PAGE_MAPPINGS = [(852, 'cp1250'), (737, 'cp1253'), (775, 'cp1257'), (855, 'cp1251'), (857, 'cp1254'),
+CODE_PAGE_MAPPINGS = [
+ (852, 'cp1250'), (737, 'cp1253'), (775, 'cp1257'), (855, 'cp1251'), (857, 'cp1254'),
(866, 'cp1251'), (869, 'cp1253'), (862, 'cp1255'), (874, 'cp874')]
-TEST_FIELD_DESCS = [TestFieldDesc('Title', FieldType.String, 50),
+TEST_FIELD_DESCS = [
+ TestFieldDesc('Title', FieldType.String, 50),
TestFieldDesc('Text Percentage Bottom', FieldType.Int16, 2), TestFieldDesc('RecID', FieldType.Int32, 4),
TestFieldDesc('Default Background', FieldType.Logical, 1), TestFieldDesc('Words', FieldType.Memo, 250),
TestFieldDesc('Words', FieldType.Memo, 250), TestFieldDesc('BK Bitmap', FieldType.Blob, 10),
TestFieldDesc('Last Modified', FieldType.Timestamp, 10)]
-TEST_FIELDS = [b'A Heart Like Thine\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', 32868, 2147483750,
+TEST_FIELDS = [
+ b'A Heart Like Thine\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', 32868, 2147483750,
129, b'{\\rtf1\\ansi\\deff0\\deftab254{\\fonttbl{\\f0\\fnil\\fcharset0 Arial;}{\\f1\\fnil\\fcharset0 Verdana;}}'
- b'{\\colortbl\\red0\\green0\\blue0;\\red255\\green0\\blue0;\\red0\\green128\\blue0;\\red0\\green0\\blue255;'
- b'\\red255\\green255\\blue0;\\red255\\green0\\blue255;\\red128\\g\xBF\xBD\7\0f\r\0\0\1\0',
- b'{\\rtf1\\ansi\\deff0\\deftab254{\\fonttbl{\\f0\\fnil\\fcharset0 Arial;}{\\f1\\fnil\\fcharset0 Verdana;}}'
- b'{\\colortbl\\red0\\green0\\blue0;\\red255\\green0\\blue0;\\red0\\green128\\blue0;\\red0\\green0\\blue255;\\red255'
- b'\\green255\\blue0;\\red255\\green0\\blue255;\\red128\\g\6\0\xEF\xBF\xBD\6\0\0\1\0', b'\0\0\0\0\0\0\0\0\0\0', 0]
+ b'{\\colortbl\\red0\\green0\\blue0;\\red255\\green0\\blue0;\\red0\\green128\\blue0;\\red0\\green0\\blue255;'
+ b'\\red255\\green255\\blue0;\\red255\\green0\\blue255;\\red128\\g\xBF\xBD\7\0f\r\0\0\1\0',
+ b'{\\rtf1\\ansi\\deff0\\deftab254{\\fonttbl{\\f0\\fnil\\fcharset0 Arial;}{\\f1\\fnil\\fcharset0 Verdana;}}'
+ b'{\\colortbl\\red0\\green0\\blue0;\\red255\\green0\\blue0;\\red0\\green128\\blue0;\\red0\\green0'
+ b'\\blue255;\\red255'
+ b'\\green255\\blue0;\\red255\\green0\\blue255;\\red128\\g\6\0\xEF\xBF\xBD\6\0\0\1\0',
+ b'\0\0\0\0\0\0\0\0\0\0', 0]
GET_MEMO_FIELD_TEST_RESULTS = [
- (4, b'\2', {'return': b'\2','read': (1, 3430), 'seek': (507136, (8, os.SEEK_CUR))}),
+ (4, b'\2', {'return': b'\2', 'read': (1, 3430), 'seek': (507136, (8, os.SEEK_CUR))}),
(4, b'\3', {'return': b'', 'read': (1, ), 'seek': (507136, )}),
(5, b'\3', {'return': b'\3', 'read': (1, 1725), 'seek': (3220111360, (41, os.SEEK_CUR), 3220111408)}),
(5, b'\4', {'return': b'', 'read': (), 'seek': ()})]
+
class TestEasyWorshipSongImport(TestCase):
"""
Test the functions in the :mod:`ewimport` module.
@@ -135,7 +141,7 @@
self.assertIsNotNone(field_desc_entry, 'Import should not be none')
self.assertEquals(field_desc_entry.name, name, 'FieldDescEntry.name should be the same as the name argument')
self.assertEquals(field_desc_entry.field_type, field_type,
- 'FieldDescEntry.type should be the same as the typeargument')
+ 'FieldDescEntry.type should be the same as the type argument')
self.assertEquals(field_desc_entry.size, size, 'FieldDescEntry.size should be the same as the size argument')
def create_importer_test(self):
@@ -164,7 +170,7 @@
# WHEN: Called with a field name that exists
existing_fields = ['Title', 'Text Percentage Bottom', 'RecID', 'Default Background', 'Words',
- 'BK Bitmap', 'Last Modified']
+ 'BK Bitmap', 'Last Modified']
for field_name in existing_fields:
# THEN: The item corresponding the index returned should have the same name attribute
@@ -194,7 +200,7 @@
# GIVEN: A mocked out SongImport class, a mocked out struct class, and a mocked out "manager" and a list of
# field descriptions
with patch('openlp.plugins.songs.lib.ewimport.SongImport'), \
- patch('openlp.plugins.songs.lib.ewimport.struct') as mocked_struct:
+ patch('openlp.plugins.songs.lib.ewimport.struct') as mocked_struct:
mocked_manager = MagicMock()
importer = EasyWorshipSongImport(mocked_manager, filenames=[])
@@ -225,7 +231,8 @@
# THEN: get_field should return the known results
self.assertEquals(return_value, result,
- 'get_field should return "%s" when called with "%s"' % (result, TEST_FIELDS[field_index]))
+ 'get_field should return "%s" when called with "%s"' %
+ (result, TEST_FIELDS[field_index]))
def get_memo_field_test(self):
"""
@@ -265,7 +272,7 @@
"""
# GIVEN: A mocked out SongImport class, a mocked out "manager"
with patch('openlp.plugins.songs.lib.ewimport.SongImport'), \
- patch('openlp.plugins.songs.lib.ewimport.os.path') as mocked_os_path:
+ patch('openlp.plugins.songs.lib.ewimport.os.path') as mocked_os_path:
mocked_manager = MagicMock()
importer = EasyWorshipSongImport(mocked_manager, filenames=[])
mocked_os_path.isfile.side_effect = [True, False]
@@ -284,7 +291,7 @@
"""
# GIVEN: A mocked out SongImport class, os.path and a mocked out "manager"
with patch('openlp.plugins.songs.lib.ewimport.SongImport'), \
- patch('openlp.plugins.songs.lib.ewimport.os.path') as mocked_os_path:
+ patch('openlp.plugins.songs.lib.ewimport.os.path') as mocked_os_path:
mocked_manager = MagicMock()
importer = EasyWorshipSongImport(mocked_manager, filenames=[])
mocked_os_path.isfile.return_value = True
@@ -305,7 +312,7 @@
with patch('openlp.plugins.songs.lib.ewimport.SongImport'), \
patch('openlp.plugins.songs.lib.ewimport.os.path') as mocked_os_path, \
patch('builtins.open') as mocked_open, \
- patch('openlp.plugins.songs.lib.ewimport.struct') as mocked_struct:
+ patch('openlp.plugins.songs.lib.ewimport.struct') as mocked_struct:
mocked_manager = MagicMock()
importer = EasyWorshipSongImport(mocked_manager, filenames=[])
mocked_os_path.isfile.return_value = True
@@ -320,7 +327,7 @@
for effect in struct_unpack_return_values:
self.assertIsNone(importer.do_import(), 'do_import should return None when db_size is less than 0x800')
self.assertEqual(mocked_open().close.call_count, 2,
- 'The open db and memo files should have been closed')
+ 'The open db and memo files should have been closed')
mocked_open().close.reset_mock()
self.assertIs(mocked_open().seek.called, False, 'db_file.seek should not have been called.')
@@ -332,7 +339,8 @@
with patch('openlp.plugins.songs.lib.ewimport.SongImport'), \
patch('openlp.plugins.songs.lib.ewimport.os.path') as mocked_os_path, \
patch('builtins.open'), patch('openlp.plugins.songs.lib.ewimport.struct') as mocked_struct, \
- patch('openlp.plugins.songs.lib.ewimport.retrieve_windows_encoding') as mocked_retrieve_windows_encoding:
+ patch('openlp.plugins.songs.lib.ewimport.retrieve_windows_encoding') as \
+ mocked_retrieve_windows_encoding:
mocked_manager = MagicMock()
importer = EasyWorshipSongImport(mocked_manager, filenames=[])
mocked_os_path.isfile.return_value = True
@@ -357,7 +365,8 @@
# GIVEN: Test files with a mocked out SongImport class, a mocked out "manager", a mocked out "import_wizard",
# and mocked out "author", "add_copyright", "add_verse", "finish" methods.
with patch('openlp.plugins.songs.lib.ewimport.SongImport'), \
- patch('openlp.plugins.songs.lib.ewimport.retrieve_windows_encoding') as mocked_retrieve_windows_encoding:
+ patch('openlp.plugins.songs.lib.ewimport.retrieve_windows_encoding') as \
+ mocked_retrieve_windows_encoding:
mocked_retrieve_windows_encoding.return_value = 'cp1252'
mocked_manager = MagicMock()
mocked_import_wizard = MagicMock()
@@ -395,10 +404,10 @@
self.assertEqual(importer.copyright, song_copyright)
if ccli_number:
self.assertEquals(importer.ccli_number, ccli_number, 'ccli_number for %s should be %s'
- % (title, ccli_number))
+ % (title, ccli_number))
for verse_text, verse_tag in add_verse_calls:
mocked_add_verse.assert_any_call(verse_text, verse_tag)
if verse_order_list:
- self.assertEquals(importer.verse_order_list, verse_order_list, 'verse_order_list for %s should be %s'
- % (title, verse_order_list))
+ self.assertEquals(importer.verse_order_list, verse_order_list,
+ 'verse_order_list for %s should be %s' % (title, verse_order_list))
mocked_finish.assert_called_with()
=== modified file 'tests/functional/openlp_plugins/songs/test_lib.py'
--- tests/functional/openlp_plugins/songs/test_lib.py 2013-12-24 08:56:50 +0000
+++ tests/functional/openlp_plugins/songs/test_lib.py 2014-04-04 20:24:53 +0000
@@ -44,20 +44,20 @@
"""
Mock up two songs and provide a set of lyrics for the songs_probably_equal tests.
"""
- self.full_lyrics ='''amazing grace how sweet the sound that saved a wretch like me i once was lost but now am
+ self.full_lyrics = '''amazing grace how sweet the sound that saved a wretch like me i once was lost but now am
found was blind but now i see twas grace that taught my heart to fear and grace my fears relieved how
- precious did that grace appear the hour i first believed through many dangers toils and snares i have already
- come tis grace that brought me safe thus far and grace will lead me home'''
- self.short_lyrics ='''twas grace that taught my heart to fear and grace my fears relieved how precious did that
- grace appear the hour i first believed'''
- self.error_lyrics ='''amazing how sweet the trumpet that saved a wrench like me i once was losst but now am
+ precious did that grace appear the hour i first believed through many dangers toils and snares i have
+ already come tis grace that brought me safe thus far and grace will lead me home'''
+ self.short_lyrics = '''twas grace that taught my heart to fear and grace my fears relieved how precious did
+ that grace appear the hour i first believed'''
+ self.error_lyrics = '''amazing how sweet the trumpet that saved a wrench like me i once was losst but now am
found waf blind but now i see it was grace that taught my heart to fear and grace my fears relieved how
precious did that grace appppppppear the hour i first believedxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx snares i have
already come to this grace that brought me safe so far and grace will lead me home'''
- self.different_lyrics='''on a hill far away stood an old rugged cross the emblem of suffering and shame and i love
- that old cross where the dearest and best for a world of lost sinners was slain so ill cherish the old rugged
- cross till my trophies at last i lay down i will cling to the old rugged cross and exchange it some day for a
- crown'''
+ self.different_lyrics = '''on a hill far away stood an old rugged cross the emblem of suffering and shame and
+ i love that old cross where the dearest and best for a world of lost sinners was slain so ill cherish the
+ old rugged cross till my trophies at last i lay down i will cling to the old rugged cross and exchange it
+ some day for a crown'''
self.song1 = MagicMock()
self.song2 = MagicMock()
@@ -99,7 +99,7 @@
result = songs_probably_equal(self.song1, self.song2)
# THEN: The result should be True.
- assert result == True, 'The result should be True'
+ assert result is True, 'The result should be True'
def songs_probably_equal_short_song_test(self):
"""
@@ -113,7 +113,7 @@
result = songs_probably_equal(self.song1, self.song2)
# THEN: The result should be True.
- assert result == True, 'The result should be True'
+ assert result is True, 'The result should be True'
def songs_probably_equal_error_song_test(self):
"""
@@ -127,7 +127,7 @@
result = songs_probably_equal(self.song1, self.song2)
# THEN: The result should be True.
- assert result == True, 'The result should be True'
+ assert result is True, 'The result should be True'
def songs_probably_equal_different_song_test(self):
"""
@@ -141,7 +141,7 @@
result = songs_probably_equal(self.song1, self.song2)
# THEN: The result should be False.
- assert result == False, 'The result should be False'
+ assert result is False, 'The result should be False'
def remove_typos_beginning_test(self):
"""
@@ -267,8 +267,8 @@
# WHEN: We call strip_rtf on the input RTF
result, result_enc = strip_rtf(
- '{\\rtf1 \\ansi \\ansicpg1252 {\\fonttbl \\f0 \\fswiss \\fcharset%s Helvetica;}' \
- '{\\colortbl ;\\red0 \\green0 \\blue0 ;}\\pard \\f0 %s}' % (charset, input))
+ '{\\rtf1 \\ansi \\ansicpg1252 {\\fonttbl \\f0 \\fswiss \\fcharset%s Helvetica;}'
+ '{\\colortbl ;\\red0 \\green0 \\blue0 ;}\\pard \\f0 %s}' % (charset, input))
# THEN: The stripped text matches thed expected result
assert result == exp_result, 'The result should be %s' % exp_result
=== modified file 'tests/functional/openlp_plugins/songs/test_songbeamerimport.py'
--- tests/functional/openlp_plugins/songs/test_songbeamerimport.py 2014-03-29 13:31:28 +0000
+++ tests/functional/openlp_plugins/songs/test_songbeamerimport.py 2014-04-04 20:24:53 +0000
@@ -110,7 +110,7 @@
# THEN: do_import should return none and the progress bar setMaximum should be called with the length of
# import_source.
self.assertIsNone(importer.do_import(),
- 'do_import should return None when import_source is a list and stop_import_flag is True')
+ 'do_import should return None when import_source is a list and stop_import_flag is True')
mocked_import_wizard.progress_bar.setMaximum.assert_called_with(len(importer.import_source))
def file_import_test(self):
@@ -147,9 +147,9 @@
for verse_text, verse_tag in add_verse_calls:
mocked_add_verse.assert_any_call(verse_text, verse_tag)
if song_book_name:
- self.assertEquals(importer.song_book_name, song_book_name, 'song_book_name for %s should be "%s"'
- % (song_file, song_book_name))
+ self.assertEquals(importer.song_book_name, song_book_name, 'song_book_name for %s should be "%s"' %
+ (song_file, song_book_name))
if song_number:
- self.assertEquals(importer.song_number, song_number, 'song_number for %s should be %s'
- % (song_file, song_number))
+ self.assertEquals(importer.song_number, song_number, 'song_number for %s should be %s' %
+ (song_file, song_number))
mocked_finish.assert_called_with()
=== modified file 'tests/functional/openlp_plugins/songs/test_songselect.py'
--- tests/functional/openlp_plugins/songs/test_songselect.py 2014-03-06 21:28:13 +0000
+++ tests/functional/openlp_plugins/songs/test_songselect.py 2014-04-04 20:24:53 +0000
@@ -352,7 +352,7 @@
"""
# GIVEN: A song to save, and some mocked out objects
with patch('openlp.plugins.songs.lib.songselect.clean_song') as mocked_clean_song, \
- patch('openlp.plugins.songs.lib.songselect.Author') as MockedAuthor:
+ patch('openlp.plugins.songs.lib.songselect.Author') as MockedAuthor:
song_dict = {
'title': 'Arky Arky',
'authors': ['Public Domain'],
=== modified file 'tests/functional/openlp_plugins/songs/test_songshowplusimport.py'
--- tests/functional/openlp_plugins/songs/test_songshowplusimport.py 2014-03-29 13:31:28 +0000
+++ tests/functional/openlp_plugins/songs/test_songshowplusimport.py 2014-04-04 20:24:53 +0000
@@ -115,8 +115,8 @@
# THEN: do_import should return none and the progress bar setMaximum should be called with the length of
# import_source.
- self.assertIsNone(importer.do_import(),
- 'do_import should return None when import_source is a list and stop_import_flag is True')
+ self.assertIsNone(importer.do_import(), 'do_import should return None when import_source is a list '
+ 'and stop_import_flag is True')
mocked_import_wizard.progress_bar.setMaximum.assert_called_with(len(importer.import_source))
def to_openlp_verse_tag_test(self):
@@ -129,7 +129,8 @@
importer = SongShowPlusImport(mocked_manager, filenames=[])
# WHEN: Supplied with the following arguments replicating verses being added
- test_values = [('Verse 1', VerseType.tags[VerseType.Verse] + '1'),
+ test_values = [
+ ('Verse 1', VerseType.tags[VerseType.Verse] + '1'),
('Verse 2', VerseType.tags[VerseType.Verse] + '2'),
('verse1', VerseType.tags[VerseType.Verse] + '1'),
('Verse', VerseType.tags[VerseType.Verse] + '1'),
@@ -143,8 +144,8 @@
# THEN: The returned value should should correlate with the input arguments
for original_tag, openlp_tag in test_values:
self.assertEquals(importer.to_openlp_verse_tag(original_tag), openlp_tag,
- 'SongShowPlusImport.to_openlp_verse_tag should return "%s" when called with "%s"'
- % (openlp_tag, original_tag))
+ 'SongShowPlusImport.to_openlp_verse_tag should return "%s" when called with "%s"' %
+ (openlp_tag, original_tag))
def to_openlp_verse_tag_verse_order_test(self):
"""
@@ -156,7 +157,8 @@
importer = SongShowPlusImport(mocked_manager, filenames=[])
# WHEN: Supplied with the following arguments replicating a verse order being added
- test_values = [('Verse 1', VerseType.tags[VerseType.Verse] + '1'),
+ test_values = [
+ ('Verse 1', VerseType.tags[VerseType.Verse] + '1'),
('Verse 2', VerseType.tags[VerseType.Verse] + '2'),
('verse1', VerseType.tags[VerseType.Verse] + '1'),
('Verse', VerseType.tags[VerseType.Verse] + '1'),
@@ -171,5 +173,5 @@
# THEN: The returned value should should correlate with the input arguments
for original_tag, openlp_tag in test_values:
self.assertEquals(importer.to_openlp_verse_tag(original_tag, ignore_unique=True), openlp_tag,
- 'SongShowPlusImport.to_openlp_verse_tag should return "%s" when called with "%s"'
- % (openlp_tag, original_tag))
+ 'SongShowPlusImport.to_openlp_verse_tag should return "%s" when called with "%s"' %
+ (openlp_tag, original_tag))
=== modified file 'tests/functional/openlp_plugins/songs/test_worshipcenterproimport.py'
--- tests/functional/openlp_plugins/songs/test_worshipcenterproimport.py 2014-03-06 20:40:08 +0000
+++ tests/functional/openlp_plugins/songs/test_worshipcenterproimport.py 2014-04-04 20:24:53 +0000
@@ -73,35 +73,37 @@
RECORDSET_TEST_DATA = [TestRecord(1, 'TITLE', 'Amazing Grace'),
- TestRecord(1, 'LYRICS',
- 'Amazing grace! How&crlf;sweet the sound&crlf;That saved a wretch like me!&crlf;'
- 'I once was lost,&crlf;but now am found;&crlf;Was blind, but now I see.&crlf;&crlf;'
- '\'Twas grace that&crlf;taught my heart to fear,&crlf;And grace my fears relieved;&crlf;'
- 'How precious did&crlf;that grace appear&crlf;The hour I first believed.&crlf;&crlf;'
- 'Through many dangers,&crlf;toils and snares,&crlf;I have already come;&crlf;'
- '\'Tis grace hath brought&crlf;me safe thus far,&crlf;'
- 'And grace will lead me home.&crlf;&crlf;The Lord has&crlf;promised good to me,&crlf;'
- 'His Word my hope secures;&crlf;He will my Shield&crlf;and Portion be,&crlf;'
- 'As long as life endures.&crlf;&crlf;Yea, when this flesh&crlf;and heart shall fail,&crlf;'
- 'And mortal life shall cease,&crlf;I shall possess,&crlf;within the veil,&crlf;'
- 'A life of joy and peace.&crlf;&crlf;The earth shall soon&crlf;dissolve like snow,&crlf;'
- 'The sun forbear to shine;&crlf;But God, Who called&crlf;me here below,&crlf;'
- 'Shall be forever mine.&crlf;&crlf;When we\'ve been there&crlf;ten thousand years,&crlf;'
- 'Bright shining as the sun,&crlf;We\'ve no less days to&crlf;sing God\'s praise&crlf;'
- 'Than when we\'d first begun.&crlf;&crlf;'),
+ TestRecord(
+ 1, 'LYRICS',
+ 'Amazing grace! How&crlf;sweet the sound&crlf;That saved a wretch like me!&crlf;'
+ 'I once was lost,&crlf;but now am found;&crlf;Was blind, but now I see.&crlf;&crlf;'
+ '\'Twas grace that&crlf;taught my heart to fear,&crlf;And grace my fears relieved;&crlf;'
+ 'How precious did&crlf;that grace appear&crlf;The hour I first believed.&crlf;&crlf;'
+ 'Through many dangers,&crlf;toils and snares,&crlf;I have already come;&crlf;'
+ '\'Tis grace hath brought&crlf;me safe thus far,&crlf;'
+ 'And grace will lead me home.&crlf;&crlf;The Lord has&crlf;promised good to me,&crlf;'
+ 'His Word my hope secures;&crlf;He will my Shield&crlf;and Portion be,&crlf;'
+ 'As long as life endures.&crlf;&crlf;Yea, when this flesh&crlf;and heart shall fail,&crlf;'
+ 'And mortal life shall cease,&crlf;I shall possess,&crlf;within the veil,&crlf;'
+ 'A life of joy and peace.&crlf;&crlf;The earth shall soon&crlf;dissolve like snow,&crlf;'
+ 'The sun forbear to shine;&crlf;But God, Who called&crlf;me here below,&crlf;'
+ 'Shall be forever mine.&crlf;&crlf;When we\'ve been there&crlf;ten thousand years,&crlf;'
+ 'Bright shining as the sun,&crlf;We\'ve no less days to&crlf;sing God\'s praise&crlf;'
+ 'Than when we\'d first begun.&crlf;&crlf;'),
TestRecord(2, 'TITLE', 'Beautiful Garden Of Prayer, The'),
- TestRecord(2, 'LYRICS',
- 'There\'s a garden where&crlf;Jesus is waiting,&crlf;'
- 'There\'s a place that&crlf;is wondrously fair,&crlf;For it glows with the&crlf;'
- 'light of His presence.&crlf;\'Tis the beautiful&crlf;garden of prayer.&crlf;&crlf;'
- 'Oh, the beautiful garden,&crlf;the garden of prayer!&crlf;Oh, the beautiful&crlf;'
- 'garden of prayer!&crlf;There my Savior awaits,&crlf;and He opens the gates&crlf;'
- 'To the beautiful&crlf;garden of prayer.&crlf;&crlf;There\'s a garden where&crlf;'
- 'Jesus is waiting,&crlf;And I go with my&crlf;burden and care,&crlf;'
- 'Just to learn from His&crlf;lips words of comfort&crlf;In the beautiful&crlf;'
- 'garden of prayer.&crlf;&crlf;There\'s a garden where&crlf;Jesus is waiting,&crlf;'
- 'And He bids you to come,&crlf;meet Him there;&crlf;Just to bow and&crlf;'
- 'receive a new blessing&crlf;In the beautiful&crlf;garden of prayer.&crlf;&crlf;')]
+ TestRecord(
+ 2, 'LYRICS',
+ 'There\'s a garden where&crlf;Jesus is waiting,&crlf;'
+ 'There\'s a place that&crlf;is wondrously fair,&crlf;For it glows with the&crlf;'
+ 'light of His presence.&crlf;\'Tis the beautiful&crlf;garden of prayer.&crlf;&crlf;'
+ 'Oh, the beautiful garden,&crlf;the garden of prayer!&crlf;Oh, the beautiful&crlf;'
+ 'garden of prayer!&crlf;There my Savior awaits,&crlf;and He opens the gates&crlf;'
+ 'To the beautiful&crlf;garden of prayer.&crlf;&crlf;There\'s a garden where&crlf;'
+ 'Jesus is waiting,&crlf;And I go with my&crlf;burden and care,&crlf;'
+ 'Just to learn from His&crlf;lips words of comfort&crlf;In the beautiful&crlf;'
+ 'garden of prayer.&crlf;&crlf;There\'s a garden where&crlf;Jesus is waiting,&crlf;'
+ 'And He bids you to come,&crlf;meet Him there;&crlf;Just to bow and&crlf;'
+ 'receive a new blessing&crlf;In the beautiful&crlf;garden of prayer.&crlf;&crlf;')]
SONG_TEST_DATA = [{'title': 'Amazing Grace',
'verses': [
('Amazing grace! How\nsweet the sound\nThat saved a wretch like me!\nI once was lost,\n'
@@ -118,7 +120,7 @@
'me here below,\nShall be forever mine.'),
('When we\'ve been there\nten thousand years,\nBright shining as the sun,\n'
'We\'ve no less days to\nsing God\'s praise\nThan when we\'d first begun.')]},
- {'title': 'Beautiful Garden Of Prayer, The',
+ {'title': 'Beautiful Garden Of Prayer, The',
'verses': [
('There\'s a garden where\nJesus is waiting,\nThere\'s a place that\nis wondrously fair,\n'
'For it glows with the\nlight of His presence.\n\'Tis the beautiful\ngarden of prayer.'),
@@ -129,6 +131,7 @@
('There\'s a garden where\nJesus is waiting,\nAnd He bids you to come,\nmeet Him there;\n'
'Just to bow and\nreceive a new blessing\nIn the beautiful\ngarden of prayer.')]}]
+
class TestWorshipCenterProSongImport(TestCase):
"""
Test the functions in the :mod:`worshipcenterproimport` module.
@@ -155,7 +158,7 @@
# a mocked "manager" and a mocked out log_error method.
with patch('openlp.plugins.songs.lib.worshipcenterproimport.SongImport'), \
patch('openlp.plugins.songs.lib.worshipcenterproimport.pyodbc.connect') as mocked_pyodbc_connect, \
- patch('openlp.plugins.songs.lib.worshipcenterproimport.translate') as mocked_translate:
+ patch('openlp.plugins.songs.lib.worshipcenterproimport.translate') as mocked_translate:
mocked_manager = MagicMock()
mocked_log_error = MagicMock()
mocked_translate.return_value = 'Translated Text'
@@ -171,9 +174,9 @@
# THEN: do_import should return None, and pyodbc, translate & log_error are called with known calls
self.assertIsNone(return_value, 'do_import should return None when pyodbc raises an exception.')
- mocked_pyodbc_connect.assert_called_with( 'DRIVER={Microsoft Access Driver (*.mdb)};DBQ=import_source')
+ mocked_pyodbc_connect.assert_called_with('DRIVER={Microsoft Access Driver (*.mdb)};DBQ=import_source')
mocked_translate.assert_called_with('SongsPlugin.WorshipCenterProImport',
- 'Unable to connect the WorshipCenter Pro database.')
+ 'Unable to connect the WorshipCenter Pro database.')
mocked_log_error.assert_called_with('import_source', 'Translated Text')
def song_import_test(self):
@@ -184,7 +187,7 @@
# translate method, a mocked "manager", add_verse method & mocked_finish method.
with patch('openlp.plugins.songs.lib.worshipcenterproimport.SongImport'), \
patch('openlp.plugins.songs.lib.worshipcenterproimport.pyodbc') as mocked_pyodbc, \
- patch('openlp.plugins.songs.lib.worshipcenterproimport.translate') as mocked_translate:
+ patch('openlp.plugins.songs.lib.worshipcenterproimport.translate') as mocked_translate:
mocked_manager = MagicMock()
mocked_import_wizard = MagicMock()
mocked_add_verse = MagicMock()
@@ -201,9 +204,8 @@
# WHEN: Calling the do_import method
return_value = importer.do_import()
-
- # THEN: do_import should return None, and pyodbc, import_wizard, importer.title and add_verse are called with
- # known calls
+ # THEN: do_import should return None, and pyodbc, import_wizard, importer.title and add_verse are called
+ # with known calls
self.assertIsNone(return_value, 'do_import should return None when pyodbc raises an exception.')
mocked_pyodbc.connect.assert_called_with('DRIVER={Microsoft Access Driver (*.mdb)};DBQ=import_source')
mocked_pyodbc.connect().cursor.assert_any_call()
@@ -214,10 +216,10 @@
for song_data in SONG_TEST_DATA:
title_value = song_data['title']
self.assertIn(title_value, importer._title_assignment_list,
- 'title should have been set to %s' % title_value)
+ 'title should have been set to %s' % title_value)
verse_calls = song_data['verses']
add_verse_call_count += len(verse_calls)
for call in verse_calls:
mocked_add_verse.assert_any_call(call)
self.assertEqual(mocked_add_verse.call_count, add_verse_call_count,
- 'Incorrect number of calls made to add_verse')
+ 'Incorrect number of calls made to add_verse')
=== modified file 'tests/helpers/songfileimport.py'
--- tests/helpers/songfileimport.py 2014-03-29 13:31:28 +0000
+++ tests/helpers/songfileimport.py 2014-04-04 20:24:53 +0000
@@ -116,28 +116,27 @@
if song_copyright:
self.mocked_add_copyright.assert_called_with(song_copyright)
if ccli_number:
- self.assertEquals(importer.ccli_number, ccli_number, 'ccli_number for %s should be %s'
- % (source_file_name, ccli_number))
+ self.assertEquals(importer.ccli_number, ccli_number, 'ccli_number for %s should be %s' %
+ (source_file_name, ccli_number))
for verse_text, verse_tag in add_verse_calls:
self.mocked_add_verse.assert_any_call(verse_text, verse_tag)
if topics:
self.assertEquals(importer.topics, topics, 'topics for %s should be %s' % (source_file_name, topics))
if comments:
- self.assertEquals(importer.comments, comments, 'comments for %s should be "%s"'
- % (source_file_name, comments))
+ self.assertEquals(importer.comments, comments, 'comments for %s should be "%s"' %
+ (source_file_name, comments))
if song_book_name:
- self.assertEquals(importer.song_book_name, song_book_name, 'song_book_name for %s should be "%s"'
- % (source_file_name, song_book_name))
+ self.assertEquals(importer.song_book_name, song_book_name, 'song_book_name for %s should be "%s"' %
+ (source_file_name, song_book_name))
if song_number:
- self.assertEquals(importer.song_number, song_number, 'song_number for %s should be %s'
- % (source_file_name, song_number))
+ self.assertEquals(importer.song_number, song_number, 'song_number for %s should be %s' %
+ (source_file_name, song_number))
if verse_order_list:
- self.assertEquals(importer.verse_order_list, [], 'verse_order_list for %s should be %s'
- % (source_file_name, verse_order_list))
+ self.assertEquals(importer.verse_order_list, [], 'verse_order_list for %s should be %s' %
+ (source_file_name, verse_order_list))
self.mocked_finish.assert_called_with()
def _get_data(self, data, key):
if key in data:
return data[key]
return ''
-
=== modified file 'tests/interfaces/openlp_core_lib/__init__.py'
--- tests/interfaces/openlp_core_lib/__init__.py 2014-03-14 22:08:44 +0000
+++ tests/interfaces/openlp_core_lib/__init__.py 2014-04-04 20:24:53 +0000
@@ -25,4 +25,4 @@
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
-###############################################################################
\ No newline at end of file
+###############################################################################
=== modified file 'tests/interfaces/openlp_core_lib/test_pluginmanager.py'
--- tests/interfaces/openlp_core_lib/test_pluginmanager.py 2014-03-24 16:49:50 +0000
+++ tests/interfaces/openlp_core_lib/test_pluginmanager.py 2014-04-04 20:24:53 +0000
@@ -95,4 +95,3 @@
assert 'songusage' in plugin_names, 'There should be a "songusage" plugin.'
assert 'alerts' in plugin_names, 'There should be a "alerts" plugin.'
assert 'remotes' in plugin_names, 'There should be a "remotes" plugin.'
-
=== modified file 'tests/interfaces/openlp_core_lib/test_searchedit.py'
--- tests/interfaces/openlp_core_lib/test_searchedit.py 2014-03-28 20:41:27 +0000
+++ tests/interfaces/openlp_core_lib/test_searchedit.py 2014-04-04 20:24:53 +0000
@@ -133,5 +133,3 @@
Just check if the resizeEvent() method is re-implemented.
"""
assert hasattr(self.search_edit, "resizeEvent"), "The search edit should re-implement the resizeEvent method."
-
-
\ No newline at end of file
=== modified file 'tests/interfaces/openlp_core_ui/test_mainwindow.py'
--- tests/interfaces/openlp_core_ui/test_mainwindow.py 2014-03-14 22:08:44 +0000
+++ tests/interfaces/openlp_core_ui/test_mainwindow.py 2014-04-04 20:24:53 +0000
@@ -85,4 +85,3 @@
# THEN: The current widget should have been set.
self.main_window.media_tool_box.setCurrentIndex.assert_called_with(2)
-
=== modified file 'tests/interfaces/openlp_core_ui/test_servicenotedialog.py'
--- tests/interfaces/openlp_core_ui/test_servicenotedialog.py 2014-03-14 22:08:44 +0000
+++ tests/interfaces/openlp_core_ui/test_servicenotedialog.py 2014-04-04 20:24:53 +0000
@@ -90,9 +90,8 @@
with patch('PyQt4.QtGui.QDialog.exec_'):
self.form.exec_()
self.form.text_edit.setPlainText(text)
- okWidget = self.form.button_box.button(self.form.button_box.Save)
- QtTest.QTest.mouseClick(okWidget, QtCore.Qt.LeftButton)
+ ok_widget = self.form.button_box.button(self.form.button_box.Save)
+ QtTest.QTest.mouseClick(ok_widget, QtCore.Qt.LeftButton)
# THEN the following text is returned
self.assertEqual(self.form.text_edit.toPlainText(), text, 'The new text should be returned')
-
=== modified file 'tests/interfaces/openlp_core_utils/__init__.py'
--- tests/interfaces/openlp_core_utils/__init__.py 2014-03-14 22:08:44 +0000
+++ tests/interfaces/openlp_core_utils/__init__.py 2014-04-04 20:24:53 +0000
@@ -25,4 +25,4 @@
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
-###############################################################################
\ No newline at end of file
+###############################################################################
=== modified file 'tests/interfaces/openlp_core_utils/test_utils.py'
--- tests/interfaces/openlp_core_utils/test_utils.py 2014-03-14 22:08:44 +0000
+++ tests/interfaces/openlp_core_utils/test_utils.py 2014-04-04 20:24:53 +0000
@@ -86,4 +86,3 @@
# THEN the result is false
assert result is True, 'The file is not an image file so the test should return True'
-
=== modified file 'tests/interfaces/openlp_plugins/__init__.py'
--- tests/interfaces/openlp_plugins/__init__.py 2014-03-14 22:08:44 +0000
+++ tests/interfaces/openlp_plugins/__init__.py 2014-04-04 20:24:53 +0000
@@ -25,4 +25,4 @@
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
-###############################################################################
\ No newline at end of file
+###############################################################################
=== modified file 'tests/interfaces/openlp_plugins/bibles/test_lib_http.py'
--- tests/interfaces/openlp_plugins/bibles/test_lib_http.py 2014-03-17 07:14:51 +0000
+++ tests/interfaces/openlp_plugins/bibles/test_lib_http.py 2014-04-04 20:24:53 +0000
@@ -97,4 +97,3 @@
# THEN: We should get back a valid service item
assert len(results.verse_list) == 36, 'The book of John should not have had any verses added or removed'
-
=== modified file 'tests/interfaces/openlp_plugins/bibles/test_lib_manager.py'
--- tests/interfaces/openlp_plugins/bibles/test_lib_manager.py 2014-03-15 06:29:41 +0000
+++ tests/interfaces/openlp_plugins/bibles/test_lib_manager.py 2014-04-04 20:24:53 +0000
@@ -115,4 +115,3 @@
verses = self.manager.get_verse_count_by_book_ref_id('tests', 54, 3)
# THEN the chapter count should be returned
self.assertEqual(16, verses, '1 Timothy v3 should have 16 verses returned from the bible')
-
=== modified file 'tests/interfaces/openlp_plugins/bibles/test_lib_parse_reference.py'
--- tests/interfaces/openlp_plugins/bibles/test_lib_parse_reference.py 2014-03-15 06:29:41 +0000
+++ tests/interfaces/openlp_plugins/bibles/test_lib_parse_reference.py 2014-04-04 20:24:53 +0000
@@ -83,7 +83,7 @@
# WHEN asking to parse the bible reference
results = parse_reference('1 Timothy 1', self.manager.db_cache['tests'], MagicMock(), 54)
# THEN a verse array should be returned
- self.assertEquals([(54, 1, 1, -1)], results , "The bible verses should matches the expected results")
+ self.assertEquals([(54, 1, 1, -1)], results, "The bible verses should matches the expected results")
def parse_reference_two_test(self):
"""
@@ -93,7 +93,7 @@
# WHEN asking to parse the bible reference
results = parse_reference('1 Timothy 1:1-2', self.manager.db_cache['tests'], MagicMock(), 54)
# THEN a verse array should be returned
- self.assertEquals([(54, 1, 1, 2)], results , "The bible verses should matches the expected results")
+ self.assertEquals([(54, 1, 1, 2)], results, "The bible verses should matches the expected results")
def parse_reference_three_test(self):
"""
@@ -103,4 +103,5 @@
# WHEN asking to parse the bible reference
results = parse_reference('1 Timothy 1:1-2:1', self.manager.db_cache['tests'], MagicMock(), 54)
# THEN a verse array should be returned
- self.assertEquals([(54,1,1,-1),(54,2,1,1)], results , "The bible verses should matches the expected results")
\ No newline at end of file
+ self.assertEquals([(54, 1, 1, -1), (54, 2, 1, 1)], results, "The bible verses should matches the expected "
+ "results")
=== modified file 'tests/interfaces/openlp_plugins/custom/forms/__init__.py'
--- tests/interfaces/openlp_plugins/custom/forms/__init__.py 2014-03-14 22:08:44 +0000
+++ tests/interfaces/openlp_plugins/custom/forms/__init__.py 2014-04-04 20:24:53 +0000
@@ -25,4 +25,4 @@
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
-###############################################################################
\ No newline at end of file
+###############################################################################
=== modified file 'tests/interfaces/openlp_plugins/custom/forms/test_customform.py'
--- tests/interfaces/openlp_plugins/custom/forms/test_customform.py 2014-03-17 07:14:51 +0000
+++ tests/interfaces/openlp_plugins/custom/forms/test_customform.py 2014-04-04 20:24:53 +0000
@@ -88,7 +88,6 @@
self.assertEqual(self.form.title_edit.text(), '', 'The title edit should be empty')
self.assertEqual(self.form.credit_edit.text(), '', 'The credit edit should be empty')
-
def on_add_button_clicked_test(self):
"""
Test the on_add_button_clicked_test method / add_button button.
=== modified file 'tests/interfaces/openlp_plugins/custom/forms/test_customslideform.py'
--- tests/interfaces/openlp_plugins/custom/forms/test_customslideform.py 2014-03-14 22:08:44 +0000
+++ tests/interfaces/openlp_plugins/custom/forms/test_customslideform.py 2014-04-04 20:24:53 +0000
@@ -92,4 +92,3 @@
# THEN: The dialog should have focus.
mocked_set_focus.assert_called_with()
-
=== modified file 'tests/interfaces/openlp_plugins/remotes/__init__.py'
--- tests/interfaces/openlp_plugins/remotes/__init__.py 2014-03-14 22:08:44 +0000
+++ tests/interfaces/openlp_plugins/remotes/__init__.py 2014-04-04 20:24:53 +0000
@@ -25,4 +25,4 @@
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
-###############################################################################
\ No newline at end of file
+###############################################################################
=== modified file 'tests/interfaces/openlp_plugins/songs/__init__.py'
--- tests/interfaces/openlp_plugins/songs/__init__.py 2014-03-14 22:08:44 +0000
+++ tests/interfaces/openlp_plugins/songs/__init__.py 2014-04-04 20:24:53 +0000
@@ -25,4 +25,4 @@
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
-###############################################################################
\ No newline at end of file
+###############################################################################
=== modified file 'tests/interfaces/openlp_plugins/songs/forms/__init__.py'
--- tests/interfaces/openlp_plugins/songs/forms/__init__.py 2014-03-14 22:08:44 +0000
+++ tests/interfaces/openlp_plugins/songs/forms/__init__.py 2014-04-04 20:24:53 +0000
@@ -25,4 +25,4 @@
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
-###############################################################################
\ No newline at end of file
+###############################################################################
=== modified file 'tests/interfaces/openlp_plugins/songs/forms/test_authorsform.py'
--- tests/interfaces/openlp_plugins/songs/forms/test_authorsform.py 2014-03-14 22:08:44 +0000
+++ tests/interfaces/openlp_plugins/songs/forms/test_authorsform.py 2014-04-04 20:24:53 +0000
@@ -145,4 +145,3 @@
# THEN: The display_name_edit should have the correct value
self.assertEqual(self.form.display_edit.text(), display_name, 'The display name should be set correctly')
-
=== modified file 'tests/interfaces/openlp_plugins/songs/forms/test_editverseform.py'
--- tests/interfaces/openlp_plugins/songs/forms/test_editverseform.py 2014-03-14 22:08:44 +0000
+++ tests/interfaces/openlp_plugins/songs/forms/test_editverseform.py 2014-04-04 20:24:53 +0000
@@ -120,4 +120,3 @@
# THEN: The verse text edit should have a Chorus:1 in it
self.assertIn('---[Chorus:1]---', self.form.verse_text_edit.toPlainText(),
'The verse text edit should have a "Chorus 1" marker')
-
=== modified file 'tests/utils/__init__.py'
--- tests/utils/__init__.py 2013-12-24 08:56:50 +0000
+++ tests/utils/__init__.py 2014-04-04 20:24:53 +0000
@@ -48,4 +48,3 @@
finally:
open_file.close()
return first_line
-
Follow ups