forked from openlp/openlp
Pipeline fixes
This commit is contained in:
parent
7d3f5eab9c
commit
6ea2f9d43d
@ -603,7 +603,8 @@ def transpose_verse(verse_text, transpose_value, notation, key):
|
|||||||
transposed_lyrics += word
|
transposed_lyrics += word
|
||||||
else:
|
else:
|
||||||
# This MUST be a chord
|
# This MUST be a chord
|
||||||
transposed_chord, key, lastchord = transpose_chord(word, transpose_value, notation, key, lastchord, isbass)
|
transposed_chord, key, lastchord = transpose_chord(word, transpose_value, notation, key, lastchord,
|
||||||
|
isbass)
|
||||||
isbass = False
|
isbass = False
|
||||||
transposed_lyrics += transposed_chord
|
transposed_lyrics += transposed_chord
|
||||||
# If still inside a chord tag something is wrong!
|
# If still inside a chord tag something is wrong!
|
||||||
@ -815,5 +816,6 @@ def transpose_chord(chord, transpose_value, notation, key, lastchord, isbass):
|
|||||||
if thischordchangeskey:
|
if thischordchangeskey:
|
||||||
key = note + minor
|
key = note + minor
|
||||||
else:
|
else:
|
||||||
if not isbass: lastchord = note + minor
|
if not isbass:
|
||||||
|
lastchord = note + minor
|
||||||
return transposed_chord, key, lastchord
|
return transposed_chord, key, lastchord
|
||||||
|
@ -277,7 +277,7 @@ def test_transpose_chord_up():
|
|||||||
chord = 'C'
|
chord = 'C'
|
||||||
|
|
||||||
# WHEN: Transposing it 1 up
|
# WHEN: Transposing it 1 up
|
||||||
new_chord = transpose_chord(chord, 1, 'english')
|
new_chord = transpose_chord(chord, 1, 'english', None, None, False)
|
||||||
|
|
||||||
# THEN: The chord should be transposed up one note
|
# THEN: The chord should be transposed up one note
|
||||||
assert new_chord == 'C#', 'The chord should be transposed up.'
|
assert new_chord == 'C#', 'The chord should be transposed up.'
|
||||||
@ -288,13 +288,13 @@ def test_transpose_chord_up_adv():
|
|||||||
Test that the transpose_chord() method works when transposing up an advanced chord
|
Test that the transpose_chord() method works when transposing up an advanced chord
|
||||||
"""
|
"""
|
||||||
# GIVEN: An advanced Chord
|
# GIVEN: An advanced Chord
|
||||||
chord = '(C/D#)'
|
chord = '(D/F#)'
|
||||||
|
|
||||||
# WHEN: Transposing it 1 up
|
# WHEN: Transposing it 1 up
|
||||||
new_chord = transpose_chord(chord, 1, 'english')
|
new_chord = transpose_chord(chord, 1, 'english', None, None, False)
|
||||||
|
|
||||||
# THEN: The chord should be transposed up one note
|
# THEN: The chord should be transposed up one note
|
||||||
assert new_chord == '(C#/E)', 'The chord should be transposed up.'
|
assert new_chord == '(Eb/G)', 'The chord should be transposed up.'
|
||||||
|
|
||||||
|
|
||||||
def test_transpose_chord_down():
|
def test_transpose_chord_down():
|
||||||
@ -305,7 +305,7 @@ def test_transpose_chord_down():
|
|||||||
chord = 'C'
|
chord = 'C'
|
||||||
|
|
||||||
# WHEN: Transposing it 1 down
|
# WHEN: Transposing it 1 down
|
||||||
new_chord = transpose_chord(chord, -1, 'english')
|
new_chord = transpose_chord(chord, -1, 'english', None, None, False)
|
||||||
|
|
||||||
# THEN: The chord should be transposed down one note
|
# THEN: The chord should be transposed down one note
|
||||||
assert new_chord == 'B', 'The chord should be transposed down.'
|
assert new_chord == 'B', 'The chord should be transposed down.'
|
||||||
@ -321,7 +321,7 @@ def test_transpose_chord_error():
|
|||||||
# WHEN: Transposing it 1 down
|
# WHEN: Transposing it 1 down
|
||||||
# THEN: An exception should be raised
|
# THEN: An exception should be raised
|
||||||
with pytest.raises(ValueError) as err:
|
with pytest.raises(ValueError) as err:
|
||||||
transpose_chord(chord, -1, 'english')
|
transpose_chord(chord, -1, 'english', None, None, False)
|
||||||
assert err.value != ValueError('\'T\' is not in list'), \
|
assert err.value != ValueError('\'T\' is not in list'), \
|
||||||
'ValueError exception should have been thrown for invalid chord'
|
'ValueError exception should have been thrown for invalid chord'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user