forked from openlp/openlp
More pipeline fixes
This commit is contained in:
parent
e9ad261c59
commit
d109bd55d5
@ -604,7 +604,7 @@ def transpose_verse(verse_text, transpose_value, notation, key):
|
||||
else:
|
||||
# This MUST be a chord
|
||||
transposed_chord, key, lastchord = transpose_chord(word, transpose_value, notation, key, lastchord,
|
||||
isbass)
|
||||
isbass)
|
||||
isbass = False
|
||||
transposed_lyrics += transposed_chord
|
||||
# If still inside a chord tag something is wrong!
|
||||
|
@ -275,12 +275,17 @@ def test_transpose_chord_up():
|
||||
"""
|
||||
# GIVEN: A Chord
|
||||
chord = 'C'
|
||||
key = None
|
||||
lastchord = None
|
||||
isbass = False
|
||||
|
||||
# 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
|
||||
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():
|
||||
@ -289,13 +294,22 @@ def test_transpose_chord_up_adv():
|
||||
"""
|
||||
# GIVEN: An advanced Chord
|
||||
chord = '(D/F#)'
|
||||
|
||||
key = None
|
||||
lastchord = None
|
||||
isbass = False
|
||||
chordsplit = chord.split("/")
|
||||
# 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
|
||||
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():
|
||||
"""
|
||||
@ -303,12 +317,17 @@ def test_transpose_chord_down():
|
||||
"""
|
||||
# GIVEN: A Chord
|
||||
chord = 'C'
|
||||
key = None
|
||||
lastchord = None
|
||||
isbass = False
|
||||
|
||||
# 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
|
||||
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():
|
||||
|
Loading…
Reference in New Issue
Block a user