forked from openlp/openlp
More pipeline fixes
This commit is contained in:
parent
6ea2f9d43d
commit
d0d9653c67
@ -604,7 +604,7 @@ def transpose_verse(verse_text, transpose_value, notation, key):
|
|||||||
else:
|
else:
|
||||||
# This MUST be a chord
|
# This MUST be a chord
|
||||||
transposed_chord, key, lastchord = transpose_chord(word, transpose_value, notation, key, lastchord,
|
transposed_chord, key, lastchord = transpose_chord(word, transpose_value, notation, key, lastchord,
|
||||||
isbass)
|
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!
|
||||||
|
@ -275,12 +275,17 @@ def test_transpose_chord_up():
|
|||||||
"""
|
"""
|
||||||
# GIVEN: A Chord
|
# GIVEN: A Chord
|
||||||
chord = 'C'
|
chord = 'C'
|
||||||
|
key = None
|
||||||
|
lastchord = None
|
||||||
|
isbass = False
|
||||||
|
|
||||||
# WHEN: Transposing it 1 up
|
# WHEN: Transposing it 1 up
|
||||||
new_chord = transpose_chord(chord, 1, 'english', None, None, False)
|
new_chord, key, lastchord = transpose_chord(chord, 1, 'english', key, lastchord, isbass)
|
||||||
|
|
||||||
# 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.'
|
||||||
|
assert key == None, 'The key should not be set'
|
||||||
|
assert lastchord == 'C#', 'If not isbass, then lastchord should be returned'
|
||||||
|
|
||||||
|
|
||||||
def test_transpose_chord_up_adv():
|
def test_transpose_chord_up_adv():
|
||||||
@ -289,13 +294,22 @@ def test_transpose_chord_up_adv():
|
|||||||
"""
|
"""
|
||||||
# GIVEN: An advanced Chord
|
# GIVEN: An advanced Chord
|
||||||
chord = '(D/F#)'
|
chord = '(D/F#)'
|
||||||
|
key = None
|
||||||
|
lastchord = None
|
||||||
|
isbass = False
|
||||||
|
chordsplit = chord.split("/")
|
||||||
# WHEN: Transposing it 1 up
|
# WHEN: Transposing it 1 up
|
||||||
new_chord = transpose_chord(chord, 1, 'english', None, None, False)
|
new_chord, key, lastchord = transpose_chord(chordsplit[0], 1, 'english', key, lastchord, isbass)
|
||||||
|
|
||||||
|
# AFTER "/" isbass is true, lastchord is set
|
||||||
|
isbass = True
|
||||||
|
new_bass, key, lastchord = transpose_chord(chordsplit[1], 1, 'english', key, lastchord, isbass)
|
||||||
|
|
||||||
# THEN: The chord should be transposed up one note
|
# THEN: The chord should be transposed up one note
|
||||||
assert new_chord == '(Eb/G)', 'The chord should be transposed up.'
|
assert new_chord == '(Eb', 'The chord should be transposed up.'
|
||||||
|
assert new_bass == 'G)', 'Bass should be transposed up.'
|
||||||
|
assert key == None, 'no key should be defined'
|
||||||
|
assert lastchord == 'Eb', 'lastchord is generated'
|
||||||
|
|
||||||
def test_transpose_chord_down():
|
def test_transpose_chord_down():
|
||||||
"""
|
"""
|
||||||
@ -303,12 +317,17 @@ def test_transpose_chord_down():
|
|||||||
"""
|
"""
|
||||||
# GIVEN: A Chord
|
# GIVEN: A Chord
|
||||||
chord = 'C'
|
chord = 'C'
|
||||||
|
key = None
|
||||||
|
lastchord = None
|
||||||
|
isbass = False
|
||||||
|
|
||||||
# WHEN: Transposing it 1 down
|
# WHEN: Transposing it 1 down
|
||||||
new_chord = transpose_chord(chord, -1, 'english', None, None, False)
|
new_chord, key, lastchord = transpose_chord(chord, -1, 'english', key, lastchord, isbass)
|
||||||
|
|
||||||
# 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.'
|
||||||
|
assert key == None, 'The key should not be set'
|
||||||
|
assert lastchord == 'B', 'If not isbass, then lastchord should be returned'
|
||||||
|
|
||||||
|
|
||||||
def test_transpose_chord_error():
|
def test_transpose_chord_error():
|
||||||
|
Loading…
Reference in New Issue
Block a user