Pipeline fixes

This commit is contained in:
STEPHANVS 2021-07-22 22:48:10 +02:00
parent 940eb5d63e
commit e9ad261c59
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 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

View File

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