Pipeline fixes

This commit is contained in:
STEPHANVS 2021-07-22 22:48:10 +02:00
parent 7d3f5eab9c
commit 6ea2f9d43d
No known key found for this signature in database
GPG Key ID: 4EFE47E471FD62A9
2 changed files with 108 additions and 106 deletions

View File

@ -603,7 +603,8 @@ def transpose_verse(verse_text, transpose_value, notation, key):
transposed_lyrics += word
else:
# 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
transposed_lyrics += transposed_chord
# 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:
key = note + minor
else:
if not isbass: lastchord = note + minor
if not isbass:
lastchord = note + minor
return transposed_chord, key, lastchord

View File

@ -277,7 +277,7 @@ def test_transpose_chord_up():
chord = 'C'
# 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
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
"""
# GIVEN: An advanced Chord
chord = '(C/D#)'
chord = '(D/F#)'
# 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
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():
@ -305,7 +305,7 @@ def test_transpose_chord_down():
chord = 'C'
# 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
assert new_chord == 'B', 'The chord should be transposed down.'
@ -321,7 +321,7 @@ def test_transpose_chord_error():
# WHEN: Transposing it 1 down
# THEN: An exception should be raised
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'), \
'ValueError exception should have been thrown for invalid chord'