openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #23418
[Merge] lp:~googol/openlp/tests into lp:openlp
Andreas Preikschat has proposed merging lp:~googol/openlp/tests into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~googol/openlp/tests/+merge/218134
Hello,
- removed not working tests
- removed not needed imports
- removed u' from doc
- use enumerate() instead of second for loop
- do not override build-ins
lp:~googol/openlp/tests (revision 2363)
[SUCCESS] http://ci.openlp.org/job/Branch-01-Pull/420/
[SUCCESS] http://ci.openlp.org/job/Branch-02-Functional-Tests/376/
[SUCCESS] http://ci.openlp.org/job/Branch-03-Interface-Tests/321/
[SUCCESS] http://ci.openlp.org/job/Branch-04-Windows_Tests/282/
[SUCCESS] http://ci.openlp.org/job/Branch-05a-Code_Analysis/191/
[SUCCESS] http://ci.openlp.org/job/Branch-05b-Test_Coverage/66/
--
https://code.launchpad.net/~googol/openlp/tests/+merge/218134
Your team OpenLP Core is requested to review the proposed merge of lp:~googol/openlp/tests into lp:openlp.
=== modified file 'openlp/core/common/applocation.py'
--- openlp/core/common/applocation.py 2014-03-20 19:10:31 +0000
+++ openlp/core/common/applocation.py 2014-05-02 18:15:52 +0000
@@ -110,7 +110,7 @@
:param extension:
Defaults to *None*. The extension to search for. For example::
- u'.png'
+ '.png'
"""
path = AppLocation.get_data_path()
if section:
=== modified file 'openlp/core/common/settings.py'
--- openlp/core/common/settings.py 2014-03-17 19:05:55 +0000
+++ openlp/core/common/settings.py 2014-05-02 18:15:52 +0000
@@ -68,8 +68,7 @@
``__obsolete_settings__``
Each entry is structured in the following way::
- (u'general/enable slide loop', u'advanced/slide limits',
- [(SlideLimits.Wrap, True), (SlideLimits.End, False)])
+ ('general/enable slide loop', 'advanced/slide limits', [(SlideLimits.Wrap, True), (SlideLimits.End, False)])
The first entry is the *old key*; it will be removed.
=== modified file 'openlp/core/lib/__init__.py'
--- openlp/core/lib/__init__.py 2014-04-12 20:19:22 +0000
+++ openlp/core/lib/__init__.py 2014-05-02 18:15:52 +0000
@@ -296,8 +296,7 @@
:param string_list: List of unicode strings
"""
- if LooseVersion(Qt.PYQT_VERSION_STR) >= LooseVersion('4.9') and \
- LooseVersion(Qt.qVersion()) >= LooseVersion('4.8'):
+ if LooseVersion(Qt.PYQT_VERSION_STR) >= LooseVersion('4.9') and LooseVersion(Qt.qVersion()) >= LooseVersion('4.8'):
return QtCore.QLocale().createSeparatedList(string_list)
if not string_list:
return ''
=== modified file 'openlp/core/lib/plugin.py'
--- openlp/core/lib/plugin.py 2014-04-12 20:19:22 +0000
+++ openlp/core/lib/plugin.py 2014-05-02 18:15:52 +0000
@@ -129,7 +129,7 @@
class MyPlugin(Plugin):
def __init__(self):
- super(MyPlugin, self).__init__('MyPlugin', version=u'0.1')
+ super(MyPlugin, self).__init__('MyPlugin', version='0.1')
:param name: Defaults to *None*. The name of the plugin.
:param default_settings: A dict containing the plugin's settings. The value to each key is the default value
=== modified file 'openlp/core/lib/screen.py'
--- openlp/core/lib/screen.py 2014-03-17 19:05:55 +0000
+++ openlp/core/lib/screen.py 2014-05-02 18:15:52 +0000
@@ -63,8 +63,7 @@
"""
Initialise the screen list.
- ``desktop``
- A ``QDesktopWidget`` object.
+ :param desktop: A QDesktopWidget object.
"""
screen_list = cls()
screen_list.desktop = desktop
@@ -136,7 +135,7 @@
Returns a list with the screens. This should only be used to display
available screens to the user::
- [u'Screen 1 (primary)', u'Screen 2']
+ ['Screen 1 (primary)', 'Screen 2']
"""
screen_list = []
for screen in self.screen_list:
@@ -153,9 +152,9 @@
:param screen: A dict with the screen properties::
{
- u'primary': True,
- u'number': 0,
- u'size': PyQt4.QtCore.QRect(0, 0, 1024, 768)
+ 'primary': True,
+ 'number': 0,
+ 'size': PyQt4.QtCore.QRect(0, 0, 1024, 768)
}
"""
log.info('Screen %d found with resolution %s' % (screen['number'], screen['size']))
=== modified file 'openlp/core/ui/aboutform.py'
--- openlp/core/ui/aboutform.py 2013-12-24 08:56:50 +0000
+++ openlp/core/ui/aboutform.py 2014-05-02 18:15:52 +0000
@@ -30,7 +30,7 @@
The About dialog.
"""
-from PyQt4 import QtCore, QtGui
+from PyQt4 import QtGui
from .aboutdialog import Ui_AboutDialog
from openlp.core.lib import translate
=== modified file 'openlp/core/ui/exceptiondialog.py'
--- openlp/core/ui/exceptiondialog.py 2014-04-12 20:19:22 +0000
+++ openlp/core/ui/exceptiondialog.py 2014-05-02 18:15:52 +0000
@@ -30,7 +30,7 @@
The GUI widgets of the exception dialog.
"""
-from PyQt4 import QtCore, QtGui
+from PyQt4 import QtGui
from openlp.core.lib import translate
from openlp.core.lib.ui import create_button, create_button_box
=== modified file 'openlp/core/ui/firsttimeform.py'
--- openlp/core/ui/firsttimeform.py 2014-04-21 09:49:17 +0000
+++ openlp/core/ui/firsttimeform.py 2014-05-02 18:15:52 +0000
@@ -199,8 +199,8 @@
self.no_internet_label.setText(self.no_internet_text + self.cancelWizardText)
elif page_id == FirstTimePage.Defaults:
self.theme_combo_box.clear()
- for iter in range(self.themes_list_widget.count()):
- item = self.themes_list_widget.item(iter)
+ for index in range(self.themes_list_widget.count()):
+ item = self.themes_list_widget.item(index)
if item.checkState() == QtCore.Qt.Checked:
self.theme_combo_box.addItem(item.text())
if self.has_run_wizard:
@@ -292,13 +292,9 @@
"""
themes = self.config.get('themes', 'files')
themes = themes.split(',')
- for theme in themes:
- filename = self.config.get('theme_%s' % theme, 'filename')
+ for index, theme in enumerate(themes):
screenshot = self.config.get('theme_%s' % theme, 'screenshot')
- for index in range(self.themes_list_widget.count()):
- item = self.themes_list_widget.item(index)
- if item.data(QtCore.Qt.UserRole) == filename:
- break
+ item = self.themes_list_widget.item(index)
item.setIcon(build_icon(os.path.join(gettempdir(), 'openlp', screenshot)))
def _get_file_size(self, url):
=== modified file 'openlp/core/ui/media/mediaplayer.py'
--- openlp/core/ui/media/mediaplayer.py 2014-03-20 19:10:31 +0000
+++ openlp/core/ui/media/mediaplayer.py 2014-05-02 18:15:52 +0000
@@ -29,8 +29,6 @@
"""
The :mod:`~openlp.core.ui.media.mediaplayer` module contains the MediaPlayer class.
"""
-import os
-
from openlp.core.common import RegistryProperties
from openlp.core.ui.media import MediaState
=== modified file 'openlp/core/ui/media/phononplayer.py'
--- openlp/core/ui/media/phononplayer.py 2014-03-20 19:10:31 +0000
+++ openlp/core/ui/media/phononplayer.py 2014-05-02 18:15:52 +0000
@@ -33,10 +33,8 @@
import mimetypes
from datetime import datetime
-from PyQt4 import QtGui
from PyQt4.phonon import Phonon
-from openlp.core.common import Settings
from openlp.core.lib import translate
from openlp.core.ui.media import MediaState
=== modified file 'openlp/core/ui/printserviceform.py'
--- openlp/core/ui/printserviceform.py 2014-03-20 19:10:31 +0000
+++ openlp/core/ui/printserviceform.py 2014-05-02 18:15:52 +0000
@@ -242,7 +242,7 @@
Creates a html element. If ``text`` is given, the element's text will set and if a ``parent`` is given,
the element is appended.
- :param tag: The html tag, e. g. ``u'span'``. Defaults to ``None``.
+ :param tag: The html tag, e. g. ``'span'``. Defaults to ``None``.
:param text: The text for the tag. Defaults to ``None``.
:param parent: The parent element. Defaults to ``None``.
:param classId: Value for the class attribute
=== modified file 'openlp/core/ui/themestab.py'
--- openlp/core/ui/themestab.py 2014-04-12 20:19:22 +0000
+++ openlp/core/ui/themestab.py 2014-05-02 18:15:52 +0000
@@ -190,7 +190,7 @@
:param theme_list: The list of available themes::
- [u'Bible Theme', u'Song Theme']
+ ['Bible Theme', 'Song Theme']
"""
# Reload as may have been triggered by the ThemeManager.
self.global_theme = Settings().value(self.settings_section + '/global theme')
=== modified file 'openlp/core/ui/wizard.py'
--- openlp/core/ui/wizard.py 2014-03-30 21:42:46 +0000
+++ openlp/core/ui/wizard.py 2014-05-02 18:15:52 +0000
@@ -279,7 +279,7 @@
:param filters: The file extension filters. It should contain the file description
as well as the file extension. For example::
- u'OpenLP 2.0 Databases (*.sqlite)'
+ 'OpenLP 2.0 Databases (*.sqlite)'
"""
if filters:
filters += ';;'
=== modified file 'openlp/core/utils/__init__.py'
--- openlp/core/utils/__init__.py 2014-04-12 20:19:22 +0000
+++ openlp/core/utils/__init__.py 2014-05-02 18:15:52 +0000
@@ -113,7 +113,7 @@
"""
Returns the application version of the running instance of OpenLP::
- {u'full': u'1.9.4-bzr1249', u'version': u'1.9.4', u'build': u'bzr1249'}
+ {'full': '1.9.4-bzr1249', 'version': '1.9.4', 'build': 'bzr1249'}
"""
global APPLICATION_VERSION
if APPLICATION_VERSION:
=== modified file 'openlp/plugins/alerts/forms/__init__.py'
--- openlp/plugins/alerts/forms/__init__.py 2013-12-24 08:56:50 +0000
+++ openlp/plugins/alerts/forms/__init__.py 2014-05-02 18:15:52 +0000
@@ -32,7 +32,7 @@
The first class, commonly known as the **Dialog** class, is typically named ``Ui_<name>Dialog``. It is a slightly
modified version of the class that the ``pyuic4`` command produces from Qt4's .ui file. Typical modifications will be
-converting most strings from "" to u'' and using OpenLP's ``translate()`` function for translating strings.
+converting most strings from "" to '' and using OpenLP's ``translate()`` function for translating strings.
The second class, commonly known as the **Form** class, is typically named ``<name>Form``. This class is the one which
is instantiated and used. It uses dual inheritance to inherit from (usually) QtGui.QDialog and the Ui class mentioned
=== modified file 'openlp/plugins/bibles/forms/__init__.py'
--- openlp/plugins/bibles/forms/__init__.py 2013-12-24 08:56:50 +0000
+++ openlp/plugins/bibles/forms/__init__.py 2014-05-02 18:15:52 +0000
@@ -33,7 +33,7 @@
The first class, commonly known as the **Dialog** class, is typically named ``Ui_<name>Dialog``. It is a slightly
modified version of the class that the ``pyuic4`` command produces from Qt4's .ui file. Typical modifications will be
-converting most strings from "" to u'' and using OpenLP's ``translate()`` function for translating strings.
+converting most strings from "" to '' and using OpenLP's ``translate()`` function for translating strings.
The second class, commonly known as the **Form** class, is typically named ``<name>Form``. This class is the one which
is instantiated and used. It uses dual inheritance to inherit from (usually) QtGui.QDialog and the Ui class mentioned
=== modified file 'openlp/plugins/bibles/lib/__init__.py'
--- openlp/plugins/bibles/lib/__init__.py 2014-03-21 18:23:35 +0000
+++ openlp/plugins/bibles/lib/__init__.py 2014-05-02 18:15:52 +0000
@@ -262,7 +262,7 @@
For example::
- [(u'John', 3, 16, 18), (u'John', 4, 1, 1)]
+ [('John', 3, 16, 18), ('John', 4, 1, 1)]
**Reference string details:**
@@ -311,7 +311,7 @@
``(?P<to_verse>[0-9]+)``
The ``to_verse`` reference is equivalent to group 2.
- The full reference is matched against get_reference_match(u'full'). This regular expression looks like this:
+ The full reference is matched against get_reference_match('full'). This regular expression looks like this:
``^\s*(?!\s)(?P<book>[\d]*[^\d]+)(?<!\s)\s*``
The ``book`` group starts with the first non-whitespace character. There are optional leading digits followed by
=== modified file 'openlp/plugins/bibles/lib/biblestab.py'
--- openlp/plugins/bibles/lib/biblestab.py 2014-03-21 18:23:35 +0000
+++ openlp/plugins/bibles/lib/biblestab.py 2014-05-02 18:15:52 +0000
@@ -405,7 +405,7 @@
:param theme_list:
The list of available themes::
- [u'Bible Theme', u'Song Theme']
+ ['Bible Theme', 'Song Theme']
"""
self.bible_theme_combo_box.clear()
self.bible_theme_combo_box.addItem('')
=== modified file 'openlp/plugins/bibles/lib/db.py'
--- openlp/plugins/bibles/lib/db.py 2014-04-15 08:40:40 +0000
+++ openlp/plugins/bibles/lib/db.py 2014-05-02 18:15:52 +0000
@@ -370,17 +370,16 @@
This is probably the most used function. It retrieves the list of
verses based on the user's query.
- :param reference_list: This is the list of references the media manager item wants. It is
- a list of tuples, with the following format::
+ :param reference_list: This is the list of references the media manager item wants. It is a list of tuples, with
+ the following format::
(book_reference_id, chapter, start_verse, end_verse)
- Therefore, when you are looking for multiple items, simply break
- them up into references like this, bundle them into a list. This
- function then runs through the list, and returns an amalgamated
- list of ``Verse`` objects. For example::
+ Therefore, when you are looking for multiple items, simply break them up into references like this, bundle
+ them into a list. This function then runs through the list, and returns an amalgamated list of ``Verse``
+ objects. For example::
- [(u'35', 1, 1, 1), (u'35', 2, 2, 3)]
+ [('35', 1, 1, 1), ('35', 2, 2, 3)]
:param show_error:
"""
log.debug('BibleDB.get_verses("%s")' % reference_list)
=== modified file 'openlp/plugins/bibles/lib/http.py'
--- openlp/plugins/bibles/lib/http.py 2014-04-12 20:19:22 +0000
+++ openlp/plugins/bibles/lib/http.py 2014-05-02 18:15:52 +0000
@@ -534,7 +534,7 @@
them into a list. This function then runs through the list, and returns an amalgamated list of ``Verse``
objects. For example::
- [(u'35', 1, 1, 1), (u'35', 2, 2, 3)]
+ [('35', 1, 1, 1), ('35', 2, 2, 3)]
"""
log.debug('HTTPBible.get_verses("%s")', reference_list)
for reference in reference_list:
=== modified file 'openlp/plugins/bibles/lib/manager.py'
--- openlp/plugins/bibles/lib/manager.py 2014-03-17 07:14:51 +0000
+++ openlp/plugins/bibles/lib/manager.py 2014-05-02 18:15:52 +0000
@@ -54,19 +54,19 @@
WebDownload = 3
@staticmethod
- def get_class(format):
+ def get_class(bible_format):
"""
Return the appropriate implementation class.
- :param format: The Bible format.
+ :param bible_format: The Bible format.
"""
- if format == BibleFormat.OSIS:
+ if bible_format == BibleFormat.OSIS:
return OSISBible
- elif format == BibleFormat.CSV:
+ elif bible_format == BibleFormat.CSV:
return CSVBible
- elif format == BibleFormat.OpenSong:
+ elif bible_format == BibleFormat.OpenSong:
return OpenSongBible
- elif format == BibleFormat.WebDownload:
+ elif bible_format == BibleFormat.WebDownload:
return HTTPBible
else:
return None
=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py 2014-04-14 18:28:04 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py 2014-05-02 18:15:52 +0000
@@ -360,8 +360,7 @@
combo boxes on the 'Advanced Search' Tab. This is not of any importance of the 'Quick Search' Tab.
:param bible: The bible to initialise (unicode).
- :param last_book_id: The "book reference id" of the book which is chosen at the moment.
- (int)
+ :param last_book_id: The "book reference id" of the book which is chosen at the moment. (int)
"""
log.debug('initialise_advanced_bible %s, %s', bible, last_book_id)
book_data = self.plugin.manager.get_books(bible)
@@ -421,9 +420,8 @@
def update_auto_completer(self):
"""
- This updates the bible book completion list for the search field. The
- completion depends on the bible. It is only updated when we are doing a
- reference search, otherwise the auto completion list is removed.
+ This updates the bible book completion list for the search field. The completion depends on the bible. It is
+ only updated when we are doing a reference search, otherwise the auto completion list is removed.
"""
log.debug('update_auto_completer')
# Save the current search type to the configuration.
@@ -593,8 +591,7 @@
:param range_from: The first number of the range (int).
:param range_to: The last number of the range (int).
:param combo: The combo box itself (QComboBox).
- :param restore: If True, then the combo's currentText will be restored after
- adjusting (if possible).
+ :param restore: If True, then the combo's currentText will be restored after adjusting (if possible).
"""
log.debug('adjust_combo_box %s, %s, %s', combo, range_from, range_to)
if restore:
@@ -640,8 +637,8 @@
def on_quick_search_button(self):
"""
- Does a quick search and saves the search results. Quick search can
- either be "Reference Search" or "Text Search".
+ Does a quick search and saves the search results. Quick search can either be "Reference Search" or
+ "Text Search".
"""
log.debug('Quick Search Button clicked')
self.quickSearchButton.setEnabled(False)
@@ -696,8 +693,7 @@
def display_results(self, bible, second_bible=''):
"""
- Displays the search results in the media manager. All data needed for
- further action is saved for/in each row.
+ Displays the search results in the media manager. All data needed for further action is saved for/in each row.
"""
items = self.build_display_results(bible, second_bible, self.search_results)
for bible_verse in items:
@@ -708,8 +704,7 @@
def build_display_results(self, bible, second_bible, search_results):
"""
- Displays the search results in the media manager. All data needed for
- further action is saved for/in each row.
+ Displays the search results in the media manager. All data needed for further action is saved for/in each row.
"""
verse_separator = get_reference_separator('sep_v_display')
version = self.plugin.manager.get_meta_data(bible, 'name').value
@@ -837,7 +832,6 @@
# If there are no more items we check whether we have to add bible_text.
if bible_text:
raw_slides.append(bible_text.lstrip())
- bible_text = ''
# Service Item: Capabilities
if self.settings.layout_style == LayoutStyle.Continuous and not second_bible:
# Split the line but do not replace line breaks in renderer.
@@ -859,9 +853,8 @@
def format_title(self, start_bitem, old_bitem):
"""
- This method is called, when we have to change the title, because
- we are at the end of a verse range. E. g. if we want to add
- Genesis 1:1-6 as well as Daniel 2:14.
+ This method is called, when we have to change the title, because we are at the end of a verse range. E. g. if we
+ want to add Genesis 1:1-6 as well as Daniel 2:14.
:param start_bitem: The first item of a range.
:param old_bitem: The last item of a range.
@@ -891,10 +884,8 @@
def check_title(self, bitem, old_bitem):
"""
- This method checks if we are at the end of an verse range. If that is
- the case, we return True, otherwise False. E. g. if we added
-
- Genesis 1:1-6, but the next verse is Daniel 2:14, we return True.
+ This method checks if we are at the end of an verse range. If that is the case, we return True, otherwise False.
+ E. g. if we added Genesis 1:1-6, but the next verse is Daniel 2:14, we return True.
:param bitem: The item we are dealing with at the moment.
:param old_bitem: The item we were previously dealing with.
@@ -918,20 +909,17 @@
return True
elif old_chapter + 1 == chapter and (verse != 1 or old_verse !=
self.plugin.manager.get_verse_count(old_bible, old_book, old_chapter)):
- # We are in the following chapter, but the last verse was not the
- # last verse of the chapter or the current verse is not the
- # first one of the chapter.
+ # We are in the following chapter, but the last verse was not the last verse of the chapter or the current
+ # verse is not the first one of the chapter.
return True
return False
def format_verse(self, old_chapter, chapter, verse):
"""
- Formats and returns the text, each verse starts with, for the given
- chapter and verse. The text is either surrounded by round, square,
-
- curly brackets or no brackets at all. For example::
-
- u'{su}1:1{/su}'
+ Formats and returns the text, each verse starts with, for the given chapter and verse. The text is either
+ surrounded by round, square, curly brackets or no brackets at all. For example::
+
+ '{su}1:1{/su}'
:param old_chapter: The previous verse's chapter number (int).
:param chapter: The chapter number (int).
=== modified file 'openlp/plugins/custom/forms/editcustomform.py'
--- openlp/plugins/custom/forms/editcustomform.py 2014-01-01 10:56:23 +0000
+++ openlp/plugins/custom/forms/editcustomform.py 2014-05-02 18:15:52 +0000
@@ -197,7 +197,6 @@
self.slide_list_view.clear()
self.slide_list_view.addItems(slides)
else:
- old_slides = []
old_row = self.slide_list_view.currentRow()
# Create a list with all (old/unedited) slides.
old_slides = [self.slide_list_view.item(row).text() for row in range(self.slide_list_view.count())]
=== modified file 'openlp/plugins/images/forms/__init__.py'
--- openlp/plugins/images/forms/__init__.py 2013-12-24 08:56:50 +0000
+++ openlp/plugins/images/forms/__init__.py 2014-05-02 18:15:52 +0000
@@ -32,7 +32,7 @@
The first class, commonly known as the **Dialog** class, is typically named ``Ui_<name>Dialog``. It is a slightly
modified version of the class that the ``pyuic4`` command produces from Qt4's .ui file. Typical modifications will be
-converting most strings from "" to u'' and using OpenLP's ``translate()`` function for translating strings.
+converting most strings from "" to '' and using OpenLP's ``translate()`` function for translating strings.
The second class, commonly known as the **Form** class, is typically named ``<name>Form``. This class is the one which
is instantiated and used. It uses dual inheritance to inherit from (usually) QtGui.QDialog and the Ui class mentioned
=== modified file 'openlp/plugins/images/lib/db.py'
--- openlp/plugins/images/lib/db.py 2014-03-17 19:05:55 +0000
+++ openlp/plugins/images/lib/db.py 2014-05-02 18:15:52 +0000
@@ -31,7 +31,7 @@
"""
from sqlalchemy import Column, ForeignKey, Table, types
-from sqlalchemy.orm import mapper, relation, reconstructor
+from sqlalchemy.orm import mapper
from openlp.core.lib.db import BaseModel, init_db
=== modified file 'openlp/plugins/media/lib/mediaitem.py'
--- openlp/plugins/media/lib/mediaitem.py 2014-04-14 18:28:04 +0000
+++ openlp/plugins/media/lib/mediaitem.py 2014-05-02 18:15:52 +0000
@@ -314,7 +314,6 @@
def get_list(self, type=MediaType.Audio):
media = Settings().value(self.settings_section + '/media files')
media.sort(key=lambda filename: get_locale_key(os.path.split(str(filename))[1]))
- extension = []
if type == MediaType.Audio:
extension = self.media_controller.audio_extensions_list
else:
=== modified file 'openlp/plugins/presentations/lib/presentationcontroller.py'
--- openlp/plugins/presentations/lib/presentationcontroller.py 2014-04-09 10:48:12 +0000
+++ openlp/plugins/presentations/lib/presentationcontroller.py 2014-05-02 18:15:52 +0000
@@ -354,7 +354,7 @@
class MyPresentationController(PresentationController):
def __init__(self, plugin):
PresentationController.__init(
- self, plugin, u'My Presenter App')
+ self, plugin, 'My Presenter App')
:param plugin: Defaults to *None*. The presentationplugin object
:param name: Name of the application, to appear in the application
=== modified file 'openlp/plugins/songs/forms/__init__.py'
--- openlp/plugins/songs/forms/__init__.py 2013-12-24 08:56:50 +0000
+++ openlp/plugins/songs/forms/__init__.py 2014-05-02 18:15:52 +0000
@@ -34,7 +34,7 @@
The first class, commonly known as the **Dialog** class, is typically named
``Ui_<name>Dialog``. It is a slightly modified version of the class that the
``pyuic4`` command produces from Qt4's .ui file. Typical modifications will be
-converting most strings from "" to u'' and using OpenLP's ``translate()``
+converting most strings from "" to '' and using OpenLP's ``translate()``
function for translating strings.
The second class, commonly known as the **Form** class, is typically named
=== modified file 'openlp/plugins/songs/forms/editverseform.py'
--- openlp/plugins/songs/forms/editverseform.py 2014-04-12 20:19:22 +0000
+++ openlp/plugins/songs/forms/editverseform.py 2014-05-02 18:15:52 +0000
@@ -122,8 +122,6 @@
text = text[:position + 4]
match = VERSE_REGEX.match(text)
if match:
- # TODO: Not used, remove?
- # verse_tag = match.group(1)
try:
verse_num = int(match.group(2)) + 1
except ValueError:
=== modified file 'openlp/plugins/songs/forms/songimportform.py'
--- openlp/plugins/songs/forms/songimportform.py 2014-04-02 07:04:12 +0000
+++ openlp/plugins/songs/forms/songimportform.py 2014-05-02 18:15:52 +0000
@@ -231,11 +231,11 @@
"""
Opens a QFileDialog and writes the filenames to the given listbox.
- :param title: The title of the dialog (unicode).
+ :param title: The title of the dialog (str).
:param listbox: A listbox (QListWidget).
- :param filters: The file extension filters. It should contain the file descriptions
- as well as the file extensions. For example::
- u'SongBeamer Files (*.sng)'
+ :param filters: The file extension filters. It should contain the file descriptions as well as the file
+ extensions. For example::
+ 'SongBeamer Files (*.sng)'
"""
if filters:
filters += ';;'
=== modified file 'openlp/plugins/songs/forms/songselectform.py'
--- openlp/plugins/songs/forms/songselectform.py 2014-03-11 19:07:58 +0000
+++ openlp/plugins/songs/forms/songselectform.py 2014-05-02 18:15:52 +0000
@@ -319,8 +319,6 @@
def on_search_finished(self):
"""
Slot which is called when the search is completed.
-
- :param songs:
"""
self.application.process_events()
self.search_progress_bar.setVisible(False)
=== modified file 'openlp/plugins/songs/lib/__init__.py'
--- openlp/plugins/songs/lib/__init__.py 2014-04-02 07:03:53 +0000
+++ openlp/plugins/songs/lib/__init__.py 2014-05-02 18:15:52 +0000
@@ -434,7 +434,7 @@
# Current font is the font tag we last met.
font = ''
# Character encoding is defined inside fonttable.
- # font_table could contain eg u'0': u'cp1252'
+ # font_table could contain eg '0': u'cp1252'
font_table = {'': ''}
# Stack of things to keep track of when entering/leaving groups.
stack = []
=== modified file 'openlp/plugins/songs/lib/easyslidesimport.py'
--- openlp/plugins/songs/lib/easyslidesimport.py 2014-03-29 13:31:28 +0000
+++ openlp/plugins/songs/lib/easyslidesimport.py 2014-05-02 18:15:52 +0000
@@ -292,7 +292,7 @@
return True
def _extract_region(self, line):
- # this was true already: line[0:7] == u'[region':
+ # this was true already: line[0:7] == '[region':
"""
Extract the region from text
=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py 2014-04-21 09:49:17 +0000
+++ openlp/plugins/songs/lib/mediaitem.py 2014-05-02 18:15:52 +0000
@@ -518,16 +518,8 @@
log.debug('service_load')
if self.plugin.status != PluginStatus.Active or not item.data_string:
return
- if item.data_string['title'].find('@') == -1:
- # FIXME: This file seems to be an old one (prior to 1.9.5), which means, that the search title
- # (data_string[u'title']) is probably wrong. We add "@" to search title and hope that we do not add any
- # duplicate. This should work for songs without alternate title.
- temp = (re.compile(r'\W+', re.UNICODE).sub(' ', item.data_string['title'].strip()) + '@').strip().lower()
- search_results = \
- self.plugin.manager.get_all_objects(Song, Song.search_title == temp, Song.search_title.asc())
- else:
- search_results = self.plugin.manager.get_all_objects(
- Song, Song.search_title == item.data_string['title'], Song.search_title.asc())
+ search_results = self.plugin.manager.get_all_objects(
+ Song, Song.search_title == item.data_string['title'], Song.search_title.asc())
edit_id = 0
add_song = True
if search_results:
=== modified file 'openlp/plugins/songs/lib/songbeamerimport.py'
--- openlp/plugins/songs/lib/songbeamerimport.py 2014-04-20 20:19:21 +0000
+++ openlp/plugins/songs/lib/songbeamerimport.py 2014-05-02 18:15:52 +0000
@@ -171,7 +171,7 @@
:param line: The line in the file. It should consist of a tag and a value for this tag (unicode)::
- u'#Title=Nearer my God to Thee'
+ '#Title=Nearer my God to Thee'
"""
tag_val = line.split('=', 1)
if len(tag_val) == 1:
=== modified file 'openlp/plugins/songs/lib/songselect.py'
--- openlp/plugins/songs/lib/songselect.py 2014-03-06 21:28:13 +0000
+++ openlp/plugins/songs/lib/songselect.py 2014-05-02 18:15:52 +0000
@@ -146,14 +146,14 @@
try:
song_page = BeautifulSoup(self.opener.open(song['link']).read(), 'lxml')
except (TypeError, HTTPError) as e:
- log.exception(u'Could not get song from SongSelect, %s', e)
+ log.exception('Could not get song from SongSelect, %s', e)
return None
if callback:
callback()
try:
lyrics_page = BeautifulSoup(self.opener.open(song['link'] + '/lyrics').read(), 'lxml')
except (TypeError, HTTPError):
- log.exception(u'Could not get lyrics from SongSelect')
+ log.exception('Could not get lyrics from SongSelect')
return None
if callback:
callback()
=== modified file 'openlp/plugins/songs/lib/xml.py'
--- openlp/plugins/songs/lib/xml.py 2014-04-21 09:49:17 +0000
+++ openlp/plugins/songs/lib/xml.py 2014-05-02 18:15:52 +0000
@@ -344,7 +344,7 @@
"""
Tests the given text for not closed formatting tags and returns a tuple consisting of two unicode strings::
- (u'{st}{r}', u'{/r}{/st}')
+ ('{st}{r}', '{/r}{/st}')
The first unicode string are the start tags (for the next slide). The second unicode string are the end tags.
=== modified file 'tests/functional/openlp_core_lib/test_lib.py'
--- tests/functional/openlp_core_lib/test_lib.py 2014-04-20 20:19:21 +0000
+++ tests/functional/openlp_core_lib/test_lib.py 2014-05-02 18:15:52 +0000
@@ -305,7 +305,7 @@
# WHEN: We convert an image to a byte array
result = image_to_byte(mocked_image)
- # THEN: We should receive a value of u'base64mock'
+ # THEN: We should receive a value of 'base64mock'
MockedQtCore.QByteArray.assert_called_with()
MockedQtCore.QBuffer.assert_called_with(mocked_byte_array)
mocked_buffer.open.assert_called_with('writeonly')
=== modified file 'tests/functional/openlp_core_utils/test_utils.py'
--- tests/functional/openlp_core_utils/test_utils.py 2014-04-02 19:35:09 +0000
+++ tests/functional/openlp_core_utils/test_utils.py 2014-05-02 18:15:52 +0000
@@ -250,7 +250,7 @@
# THEN: The user agent is a Linux (or ChromeOS) user agent
result = 'Linux' in user_agent or 'CrOS' in user_agent
- self.assertTrue(result, u'The user agent should be a valid Linux user agent')
+ self.assertTrue(result, 'The user agent should be a valid Linux user agent')
def get_user_agent_windows_test(self):
"""
@@ -265,7 +265,7 @@
user_agent = _get_user_agent()
# THEN: The user agent is a Linux (or ChromeOS) user agent
- self.assertIn('Windows', user_agent, u'The user agent should be a valid Windows user agent')
+ self.assertIn('Windows', user_agent, 'The user agent should be a valid Windows user agent')
def get_user_agent_macos_test(self):
"""
@@ -280,7 +280,7 @@
user_agent = _get_user_agent()
# THEN: The user agent is a Linux (or ChromeOS) user agent
- self.assertIn('Mac OS X', user_agent, u'The user agent should be a valid OS X user agent')
+ self.assertIn('Mac OS X', user_agent, 'The user agent should be a valid OS X user agent')
def get_user_agent_default_test(self):
"""
@@ -295,7 +295,7 @@
user_agent = _get_user_agent()
# THEN: The user agent is a Linux (or ChromeOS) user agent
- self.assertIn('NetBSD', user_agent, u'The user agent should be the default user agent')
+ self.assertIn('NetBSD', user_agent, 'The user agent should be the default user agent')
def get_web_page_no_url_test(self):
"""
=== added directory 'tests/interfaces/openlp_core_common'
=== added file 'tests/interfaces/openlp_core_common/__init__.py'
--- tests/interfaces/openlp_core_common/__init__.py 1970-01-01 00:00:00 +0000
+++ tests/interfaces/openlp_core_common/__init__.py 2014-05-02 18:15:52 +0000
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2014 Raoul Snyman #
+# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
+# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
+# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
+# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
+# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
+# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
+# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it #
+# under the terms of the GNU General Public License as published by the Free #
+# Software Foundation; version 2 of the License. #
+# #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
+# more details. #
+# #
+# 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 #
+###############################################################################
=== added file 'tests/interfaces/openlp_core_common/test_historycombobox.py'
--- tests/interfaces/openlp_core_common/test_historycombobox.py 1970-01-01 00:00:00 +0000
+++ tests/interfaces/openlp_core_common/test_historycombobox.py 2014-05-02 18:15:52 +0000
@@ -0,0 +1,65 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2014 Raoul Snyman #
+# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
+# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
+# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
+# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
+# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
+# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
+# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it #
+# under the terms of the GNU General Public License as published by the Free #
+# Software Foundation; version 2 of the License. #
+# #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
+# more details. #
+# #
+# 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 #
+###############################################################################
+"""
+Module to test the :mod:`~openlp.core.common.historycombobox` module.
+"""
+
+from unittest import TestCase
+
+from PyQt4 import QtCore, QtGui, QtTest
+
+from openlp.core.common import Registry
+from openlp.core.common import HistoryComboBox
+from tests.helpers.testmixin import TestMixin
+from tests.interfaces import MagicMock, patch
+
+
+class TestHistoryComboBox(TestCase, TestMixin):
+ def setUp(self):
+ Registry.create()
+ self.get_application()
+ self.main_window = QtGui.QMainWindow()
+ Registry().register('main_window', self.main_window)
+ self.combo = HistoryComboBox(self.main_window)
+
+ def tearDown(self):
+ del self.combo
+
+ def getItems_test(self):
+ """
+ Test the getItems() method
+ """
+ # GIVEN: The combo.
+
+ # WHEN: Add two items.
+ self.combo.addItem('test1')
+ self.combo.addItem('test2')
+
+ # THEN: The list of items should contain both strings.
+ self.assertEqual(self.combo.getItems(), ['test1', 'test2'])
\ No newline at end of file
=== modified file 'tests/interfaces/openlp_core_lib/test_searchedit.py'
--- tests/interfaces/openlp_core_lib/test_searchedit.py 2014-04-02 19:35:09 +0000
+++ tests/interfaces/openlp_core_lib/test_searchedit.py 2014-05-02 18:15:52 +0000
@@ -30,7 +30,6 @@
Module to test the EditCustomForm.
"""
from unittest import TestCase
-from unittest.mock import MagicMock
from PyQt4 import QtCore, QtGui, QtTest
@@ -127,9 +126,3 @@
# THEN: The search edit text should be cleared and the button be hidden.
assert not self.search_edit.text(), "The search edit should not have any text."
assert self.search_edit.clear_button.isHidden(), "The clear button should be hidden."
-
- def resize_event_test(self):
- """
- Just check if the resizeEvent() method is re-implemented.
- """
- assert hasattr(self.search_edit, "resizeEvent"), "The search edit should re-implement the resizeEvent method."
=== modified file 'tests/interfaces/openlp_core_ui/test_filerenamedialog.py'
--- tests/interfaces/openlp_core_ui/test_filerenamedialog.py 2014-03-31 15:20:17 +0000
+++ tests/interfaces/openlp_core_ui/test_filerenamedialog.py 2014-05-02 18:15:52 +0000
@@ -89,7 +89,7 @@
Test that the file_name_edit setFocus has called with True when executed
"""
# GIVEN: A mocked QDialog.exec_() method and mocked file_name_edit.setFocus() method.
- with patch('PyQt4.QtGui.QDialog.exec_') as mocked_exec:
+ with patch('PyQt4.QtGui.QDialog.exec_'):
mocked_set_focus = MagicMock()
self.form.file_name_edit.setFocus = mocked_set_focus
=== removed file 'tests/interfaces/openlp_core_ui/test_splashscreen.py'
--- tests/interfaces/openlp_core_ui/test_splashscreen.py 2014-03-31 14:07:05 +0000
+++ tests/interfaces/openlp_core_ui/test_splashscreen.py 1970-01-01 00:00:00 +0000
@@ -1,60 +0,0 @@
-# -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
-
-###############################################################################
-# OpenLP - Open Source Lyrics Projection #
-# --------------------------------------------------------------------------- #
-# Copyright (c) 2008-2014 Raoul Snyman #
-# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
-# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
-# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
-# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
-# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
-# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
-# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
-# --------------------------------------------------------------------------- #
-# This program is free software; you can redistribute it and/or modify it #
-# under the terms of the GNU General Public License as published by the Free #
-# Software Foundation; version 2 of the License. #
-# #
-# This program is distributed in the hope that it will be useful, but WITHOUT #
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
-# more details. #
-# #
-# 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 #
-###############################################################################
-"""
-Test the openlp.core.ui.splashscreen class.
-"""
-from unittest import TestCase
-
-from PyQt4 import QtGui
-
-from openlp.core.ui import SplashScreen
-from tests.helpers.testmixin import TestMixin
-
-
-class TestSplashScreen(TestCase, TestMixin):
- def setUp(self):
- self.get_application()
- self.main_window = QtGui.QMainWindow()
-
- def tearDown(self):
- """
- Delete all the C++ objects at the end so that we don't have a segfault
- """
- del self.app
- del self.main_window
-
- def setupUi_test(self):
- """
- Test if the setupUi method....
- """
- # GIVEN: A splash screen instance.
- splash = SplashScreen()
-
- # THEN: Check if the splash has a setupUi method.
- assert hasattr(splash, 'setupUi'), 'The Splash Screen should have a setupUi() method.'
Follow ups