openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #26348
Re: [Merge] lp:~oliwee/openlp/bug_1424555 into lp:openlp
Review: Needs Fixing
Just a small change to a docstring :-)
Diff comments:
> === modified file 'openlp/plugins/songs/forms/editverseform.py'
> --- openlp/plugins/songs/forms/editverseform.py 2015-01-18 13:39:21 +0000
> +++ openlp/plugins/songs/forms/editverseform.py 2015-02-23 18:31:14 +0000
> @@ -98,6 +98,8 @@
> """
> Adjusts the verse number SpinBox in regard to the selected verse type and the cursor's position.
> """
> + if self.has_single_verse:
> + return
> position = self.verse_text_edit.textCursor().position()
> text = self.verse_text_edit.toPlainText()
> verse_name = VerseType.translated_names[
>
> === added file 'tests/functional/openlp_plugins/songs/test_editverseform.py'
> --- tests/functional/openlp_plugins/songs/test_editverseform.py 1970-01-01 00:00:00 +0000
> +++ tests/functional/openlp_plugins/songs/test_editverseform.py 2015-02-23 18:31:14 +0000
> @@ -0,0 +1,51 @@
> +"""
> +This module contains tests for the editverseform of the Songs plugin.
> +"""
> +from unittest import TestCase
> +
> +from PyQt4 import QtCore, QtGui
> +
> +from openlp.core.common import Registry, Settings
> +from openlp.core.lib import ServiceItem
> +from openlp.plugins.songs.forms.editverseform import EditVerseForm
> +from openlp.plugins.songs.lib.db import AuthorType
> +from tests.functional import patch, MagicMock
> +from tests.helpers.testmixin import TestMixin
> +
> +
> +class TestEditVerseForm(TestCase, TestMixin):
> + """
> + Test the functions in the :mod:`lib` module.
> + """
> + def setUp(self):
> + """
> + Set up the components need for all tests.
> + """
> + self.edit_verse_form = EditVerseForm(None)
> + self.setup_application()
> + self.build_settings()
> + QtCore.QLocale.setDefault(QtCore.QLocale('en_GB'))
> +
> + def tearDown(self):
> + """
> + Delete all the C++ objects at the end so that we don't have a segfault
> + """
> + self.destroy_settings()
> +
> + def update_suggested_verse_number_test(self):
> + """
> + Test if the update_suggested_verse_number method changes the value of
> + the verse number if has_single_verse is True
> + """
The test runner will only pick up the first line in a docstring, so put your entire description on one line. Also, I think what you're trying to say is,
"Test that update_suggested_verse_number() has no effect when editing a single verse"
> + # GIVEN some input values
> + self.edit_verse_form.has_single_verse = True
> + self.edit_verse_form.verse_type_combo_box.currentIndex = MagicMock(return_value = 0)
> + self.edit_verse_form.verse_text_edit.toPlainText = MagicMock(return_value = 'Text')
> + self.edit_verse_form.verse_number_box.setValue(3)
> +
> +
> + # WHEN the method is called
> + self.edit_verse_form.update_suggested_verse_number()
> +
> + # THEN the verse number must not be changed
> + self.assertEqual(3, self.edit_verse_form.verse_number_box.value(), 'The verse number should be 3')
>
--
https://code.launchpad.net/~oliwee/openlp/bug_1424555/+merge/250660
Your team OpenLP Core is subscribed to branch lp:openlp.
References