mirror of https://gitlab.com/bashrc2/epicyon
Another unit test for markup with bold reading
parent
9fdca7919c
commit
2c087d5e2a
|
@ -1351,7 +1351,8 @@ def bold_reading_string(text: str) -> str:
|
||||||
reading_markup = False
|
reading_markup = False
|
||||||
if not reading_markup and len(wrd) > 1 and \
|
if not reading_markup and len(wrd) > 1 and \
|
||||||
'<' not in wrd and '>' not in wrd and \
|
'<' not in wrd and '>' not in wrd and \
|
||||||
'&' not in wrd and not wrd.startswith(':'):
|
'&' not in wrd and '=' not in wrd and \
|
||||||
|
not wrd.startswith(':'):
|
||||||
|
|
||||||
prefix = ''
|
prefix = ''
|
||||||
postfix = ''
|
postfix = ''
|
||||||
|
@ -1370,6 +1371,8 @@ def bold_reading_string(text: str) -> str:
|
||||||
new_parag += wrd + ' '
|
new_parag += wrd + ' '
|
||||||
parag_ctr += 1
|
parag_ctr += 1
|
||||||
new_parag = new_parag.strip()
|
new_parag = new_parag.strip()
|
||||||
|
if not new_parag:
|
||||||
|
continue
|
||||||
if parag_ctr < len(paragraphs):
|
if parag_ctr < len(paragraphs):
|
||||||
if not add_paragraph_markup:
|
if not add_paragraph_markup:
|
||||||
new_text += new_parag + '\n'
|
new_text += new_parag + '\n'
|
||||||
|
|
14
tests.py
14
tests.py
|
@ -6739,6 +6739,20 @@ def _test_bold_reading() -> None:
|
||||||
print(text_bold)
|
print(text_bold)
|
||||||
assert text_bold == expected
|
assert text_bold == expected
|
||||||
|
|
||||||
|
text = '<p><span class=\"h-card\"><a ' + \
|
||||||
|
'href=\"https://something.social/@someone\" ' + \
|
||||||
|
'class=\"u-url mention\">@<span>Someone or other' + \
|
||||||
|
'</span></a></span> some text</p>'
|
||||||
|
text_bold = bold_reading_string(text)
|
||||||
|
expected = \
|
||||||
|
'<p><span class="h-card">' + \
|
||||||
|
'<a href="https://something.social/@someone" ' + \
|
||||||
|
'class="u-url mention">@<span>Someone <b>o</b>r other' + \
|
||||||
|
'</span></a></span> <b>so</b>me <b>te</b>xt</p>'
|
||||||
|
if text_bold != expected:
|
||||||
|
print(text_bold)
|
||||||
|
assert text_bold == expected
|
||||||
|
|
||||||
|
|
||||||
def run_all_tests():
|
def run_all_tests():
|
||||||
base_dir = os.getcwd()
|
base_dir = os.getcwd()
|
||||||
|
|
Loading…
Reference in New Issue