More pipeline fixes

This commit is contained in:
STEPHANVS 2021-07-22 23:08:23 +02:00
parent e9ad261c59
commit d109bd55d5
No known key found for this signature in database
GPG Key ID: 4EFE47E471FD62A9
2 changed files with 26 additions and 7 deletions

View File

@ -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!

View File

@ -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():