openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #29871
[Merge] lp:~raoul-snyman/openlp/bug-1589815 into lp:openlp
Raoul Snyman has proposed merging lp:~raoul-snyman/openlp/bug-1589815 into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~raoul-snyman/openlp/bug-1589815/+merge/296761
Fix bug #1589815 by first reducing the string to digits only and then checking if there's anything left.
Add this to your merge proposal:
--------------------------------
lp:~raoul-snyman/openlp/bug-1589815 (revision 2675)
[SUCCESS] https://ci.openlp.io/job/Branch-01-Pull/1603/
[SUCCESS] https://ci.openlp.io/job/Branch-02-Functional-Tests/1514/
[SUCCESS] https://ci.openlp.io/job/Branch-03-Interface-Tests/1452/
[SUCCESS] https://ci.openlp.io/job/Branch-04a-Windows_Functional_Tests/1225/
[SUCCESS] https://ci.openlp.io/job/Branch-04b-Windows_Interface_Tests/815/
[SUCCESS] https://ci.openlp.io/job/Branch-05a-Code_Analysis/883/
[SUCCESS] https://ci.openlp.io/job/Branch-05b-Test_Coverage/751/
--
Your team OpenLP Core is requested to review the proposed merge of lp:~raoul-snyman/openlp/bug-1589815 into lp:openlp.
=== modified file 'openlp/plugins/songs/lib/importers/opensong.py'
--- openlp/plugins/songs/lib/importers/opensong.py 2016-05-27 08:13:14 +0000
+++ openlp/plugins/songs/lib/importers/opensong.py 2016-06-08 08:59:41 +0000
@@ -156,8 +156,8 @@
ustring = str(root.__getattr__(attr))
if isinstance(fn_or_string, str):
if attr in ['ccli']:
+ ustring = ''.join(re.findall('\d+', ustring))
if ustring:
- ustring = ''.join(re.findall('\d+', ustring))
setattr(self, fn_or_string, int(ustring))
else:
setattr(self, fn_or_string, None)
=== modified file 'tests/functional/openlp_plugins/songs/test_opensongimport.py'
--- tests/functional/openlp_plugins/songs/test_opensongimport.py 2016-05-31 21:40:13 +0000
+++ tests/functional/openlp_plugins/songs/test_opensongimport.py 2016-06-08 08:59:41 +0000
@@ -22,13 +22,13 @@
"""
This module contains tests for the OpenSong song importer.
"""
-
import os
from unittest import TestCase
-from tests.helpers.songfileimport import SongImportTestHelper
from openlp.plugins.songs.lib.importers.opensong import OpenSongImport
from openlp.core.common import Registry
+
+from tests.helpers.songfileimport import SongImportTestHelper
from tests.functional import patch, MagicMock
TEST_PATH = os.path.abspath(
@@ -54,6 +54,8 @@
self.load_external_result_data(os.path.join(TEST_PATH, 'One, Two, Three, Four, Five.json')))
self.file_import([os.path.join(TEST_PATH, 'Amazing Grace2')],
self.load_external_result_data(os.path.join(TEST_PATH, 'Amazing Grace.json')))
+ self.file_import([os.path.join(TEST_PATH, 'Amazing Grace with bad CCLI')],
+ self.load_external_result_data(os.path.join(TEST_PATH, 'Amazing Grace without CCLI.json')))
class TestOpenSongImport(TestCase):
=== modified file 'tests/helpers/songfileimport.py'
--- tests/helpers/songfileimport.py 2015-12-31 22:46:06 +0000
+++ tests/helpers/songfileimport.py 2016-06-08 08:59:41 +0000
@@ -29,6 +29,7 @@
from openlp.plugins.songs.lib.importers.opensong import OpenSongImport
from openlp.core.common import Registry
+
from tests.functional import patch, MagicMock, call
log = logging.getLogger(__name__)
@@ -36,7 +37,7 @@
class SongImportTestHelper(TestCase):
"""
- This class is designed to be a helper class to reduce repition when testing the import of song files.
+ This class is designed to be a helper class to reduce repetition when testing the import of song files.
"""
def __init__(self, *args, **kwargs):
super(SongImportTestHelper, self).__init__(*args, **kwargs)
=== modified file 'tests/resources/opensongsongs/Amazing Grace'
--- tests/resources/opensongsongs/Amazing Grace 2014-04-22 21:43:12 +0000
+++ tests/resources/opensongsongs/Amazing Grace 2016-06-08 08:59:41 +0000
@@ -53,4 +53,4 @@
<key_line></key_line>
<time_sig></time_sig>
<style index="default_style"></style>
-</song>
\ No newline at end of file
+</song>
=== added file 'tests/resources/opensongsongs/Amazing Grace with bad CCLI'
--- tests/resources/opensongsongs/Amazing Grace with bad CCLI 1970-01-01 00:00:00 +0000
+++ tests/resources/opensongsongs/Amazing Grace with bad CCLI 2016-06-08 08:59:41 +0000
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<song>
+ <title>Amazing Grace (Demonstration)</title>
+ <author>John Newton, Edwin Excell & John P. Rees</author>
+ <copyright>Public Domain </copyright>
+ <presentation>V1 V2 V3 V4 V5</presentation>
+ <capo print="false"></capo>
+ <tempo></tempo>
+ <ccli>GE</ccli>
+ <theme>God: Assurance/Grace/Salvation</theme>
+ <alttheme>Worship: Praise</alttheme>
+ <user1> </user1>
+ <user2> </user2>
+ <user3> </user3>
+ <lyrics>[V]
+;Test the chords format
+;Chords beging with .
+;Verses begin with their verse number
+;Link words with _
+;Comments begin with ;
+. D D7 G D
+1A______ma________zing grace! How sweet the sound!
+2'Twas grace that taught my heart to fear,
+3The Lord has pro____mised good to me,
+4Thro' ma________ny dan____gers, toils and snares
+5When we've been there ten thou__sand years,
+
+. Bm E A A7
+1That saved a wretch like me!
+2And grace my fears re___lieved.
+3His Word my hope se___cures.
+4I have al___rea____dy come.
+5Bright shi___ning as the sun,
+
+. D D7 G D
+1I once was lost, but now am found;
+2How pre___cious did that grace ap____pear,
+3He will my shield and por___tion be
+4'Tis grace that brought me safe thus far,
+5We've no less days to sing God's praise,
+
+. Bm A G D
+1Was blind, but now I see.
+2The hour I first be_lieved.
+3As long as life en_dures.
+4And grace will lead me home.
+5Than when we first be_gun.
+
+</lyrics>
+ <hymn_number>Demonstration Songs 0</hymn_number>
+ <key></key>
+ <aka></aka>
+ <key_line></key_line>
+ <time_sig></time_sig>
+ <style index="default_style"></style>
+</song>
=== added file 'tests/resources/opensongsongs/Amazing Grace without CCLI.json'
--- tests/resources/opensongsongs/Amazing Grace without CCLI.json 1970-01-01 00:00:00 +0000
+++ tests/resources/opensongsongs/Amazing Grace without CCLI.json 2016-06-08 08:59:41 +0000
@@ -0,0 +1,42 @@
+{
+ "authors": [
+ "John Newton",
+ "Edwin Excell",
+ "John P. Rees"
+ ],
+ "ccli_number": null,
+ "comments": "\n\n\n",
+ "copyright": "Public Domain ",
+ "song_book_name": "Demonstration Songs",
+ "song_number": 0,
+ "title": "Amazing Grace (Demonstration)",
+ "topics": [
+ "Assurance",
+ "Grace",
+ "Praise",
+ "Salvation"
+ ],
+ "verse_order_list": [],
+ "verses": [
+ [
+ "Amazing grace! How sweet the sound!\nThat saved a wretch like me!\nI once was lost, but now am found;\nWas blind, but now I see.",
+ "v1"
+ ],
+ [
+ "'Twas grace that taught my heart to fear,\nAnd grace my fears relieved.\nHow precious did that grace appear,\nThe hour I first believed.",
+ "v2"
+ ],
+ [
+ "The Lord has promised good to me,\nHis Word my hope secures.\nHe will my shield and portion be\nAs long as life endures.",
+ "v3"
+ ],
+ [
+ "Thro' many dangers, toils and snares\nI have already come.\n'Tis grace that brought me safe thus far,\nAnd grace will lead me home.",
+ "v4"
+ ],
+ [
+ "When we've been there ten thousand years,\nBright shining as the sun,\nWe've no less days to sing God's praise,\nThan when we first begun.",
+ "v5"
+ ]
+ ]
+}
Follow ups