~tomasgroth/openlp/portable-path

« back to all changes in this revision

Viewing changes to tests/functional/openlp_plugins/songs/test_lib.py

  • Committer: Tomas Groth
  • Date: 2019-04-30 19:02:42 UTC
  • mfrom: (2829.2.32 openlp)
  • Revision ID: tomasgroth@yahoo.dk-20190430190242-6zwjk8724tyux70m
trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
###############################################################################
5
5
# OpenLP - Open Source Lyrics Projection                                      #
6
6
# --------------------------------------------------------------------------- #
7
 
# Copyright (c) 2008-2018 OpenLP Developers                                   #
 
7
# Copyright (c) 2008-2019 OpenLP Developers                                   #
8
8
# --------------------------------------------------------------------------- #
9
9
# This program is free software; you can redistribute it and/or modify it     #
10
10
# under the terms of the GNU General Public License as published by the Free  #
23
23
This module contains tests for the lib submodule of the Songs plugin.
24
24
"""
25
25
from unittest import TestCase
26
 
from unittest.mock import patch, MagicMock, PropertyMock
 
26
from unittest.mock import MagicMock, PropertyMock, patch
27
27
 
28
28
from openlp.plugins.songs.lib import VerseType, clean_string, clean_title, strip_rtf, transpose_chord, transpose_lyrics
29
 
from openlp.plugins.songs.lib.songcompare import songs_probably_equal, _remove_typos, _op_length
 
29
from openlp.plugins.songs.lib.songcompare import _op_length, _remove_typos, songs_probably_equal
30
30
 
31
31
 
32
32
class TestLib(TestCase):
199
199
        result = _remove_typos(diff)
200
200
 
201
201
        # THEN: There should be no typos in the middle anymore. The remaining equals should have been merged.
202
 
        assert len(result) is 1, 'The result should contain only one element.'
 
202
        assert len(result) == 1, 'The result should contain only one element.'
203
203
        assert result[0][0] == 'equal', 'The result should contain an equal element.'
204
204
        assert result[0][1] == 0, 'The start indices should be kept.'
205
205
        assert result[0][2] == 22, 'The stop indices should be kept.'
313
313
        # WHEN: Transposing it 1 down
314
314
        # THEN: An exception should be raised
315
315
        with self.assertRaises(ValueError) as err:
316
 
            new_chord = transpose_chord(chord, -1, 'english')
 
316
            transpose_chord(chord, -1, 'english')
317
317
        assert err.exception.args[0] == '\'T\' is not in list', \
318
318
            'ValueError exception should have been thrown for invalid chord'
319
319