Even more test fixes

This commit is contained in:
STEPHANVS 2021-07-04 18:33:18 +02:00
parent 638b5722f5
commit bf1ae4a36b
No known key found for this signature in database
GPG Key ID: 4EFE47E471FD62A9
2 changed files with 5 additions and 5 deletions

View File

@ -47,8 +47,8 @@ log = logging.getLogger(__name__)
ENGLISH_NOTES = '[CDEFGAB]?'
GERMAN_NOTES = '[CDEFGABH]?'
NEOLATIN_NOTES = '(Do|Re|Mi|Fa|Sol|La|Si)?'
CHORD_PREFIXES = '(=|\(|\|)*?'
CHORD_SUFFIXES = '(b|bb|#|##|x|-|m|maj|min|sus|dim|0|1|2|3|4|5|6|7|8|9|\))*?'
CHORD_PREFIXES = '(=|\\(|\\|)*?'
CHORD_SUFFIXES = '(b|bb|#|##|x|-|m|maj|min|sus|dim|0|1|2|3|4|5|6|7|8|9|\\))*?'
SLIM_CHARS = 'fiíIÍjlĺľrtť.,;/ ()|"\'!:\\'
CHORD_TEMPLATE = '<span class="chordline">{chord}</span>'
FIRST_CHORD_TEMPLATE = '<span class="chordline">{chord}</span>'
@ -80,7 +80,7 @@ def _construct_chord_regex(notes):
:param notes: The regular expression for a set of valid notes
:return: An expanded regular expression for valid chords
"""
#chord = CHORD_PREFIXES + notes + CHORD_SUFFIXES
# chord = CHORD_PREFIXES + notes + CHORD_SUFFIXES
return '(' + CHORD_PREFIXES + notes + CHORD_SUFFIXES + '(/' + notes + CHORD_SUFFIXES + ')?)'
@ -270,7 +270,7 @@ def render_chords(text):
rendered_lines.append(new_line)
else:
chords_on_prev_line = False
#rendered_lines.append(html.escape(line))
# rendered_lines.append(html.escape(line))
chord_template = NO_CHORD_TEMPLATE
new_line = chord_template.format(chord=line)
rendered_lines.append(new_line)

View File

@ -104,7 +104,7 @@ def test_render_chords(settings):
text_with_rendered_chords = render_chords(text_with_chords)
# THEN: We should get html that looks like below
expected_html = '<span class="chordline firstchordline">H<span class="chord"><span><strong>C</strong></span>' \
expected_html = '<span class="chordline">H<span class="chord"><span><strong>C</strong></span>' \
'</span>alleluya.<span class="chord"><span><strong>F</strong></span></span><span class="ws">' \
'&nbsp;&nbsp;</span> <span class="chord"><span><strong>G/B</strong></span></span></span>'
assert text_with_rendered_chords == expected_html, 'The rendered chords should look as expected'