Pull request #35: Fix/tests

Merge in FRAG/50ohm.de from fix/tests to main

* commit 'd01e3d07cd6371a8e50599ae6d04f5dfc108b0e5':
  refactor: remove too long comment
  test: fix QSO tests
  fix: remove debug print
This commit is contained in:
Tim Grelka DA2TG
2025-06-24 22:04:13 +02:00
committed by Tim Grelka
3 changed files with 11 additions and 7 deletions
-2
View File
@@ -52,8 +52,6 @@ class Unit(SpanToken):
unit: str
def __init__(self, match: re.Match):
print("pattern", self.pattern)
self.value = match.group("value")
self.prefix = match.group("prefix") or ""
self.unit = match.group("unit")
+10 -4
View File
@@ -7,11 +7,17 @@ from renderer.fifty_ohm_html_renderer import FiftyOhmHtmlRenderer
@pytest.mark.html
def test_table_html():
assertions = {
"<qso>\nfoo\n</qso>": FiftyOhmHtmlRenderer.render_tag_helper("qso", '<div class="qso_own">foo</div>', 1, 0) +"\n",
"<qso>\nfoo\n> bar\n</qso>": FiftyOhmHtmlRenderer.render_tag_helper("qso", '<div class="qso_own">foo</div><div class="qso_other">bar</div>', 1, 0) +"\n",
"<qso>\n*foo*\n> bar\n</qso>": FiftyOhmHtmlRenderer.render_tag_helper("qso", '<div class="qso_own"><em>foo</em></div><div class="qso_other">bar</div>', 1, 0) +"\n",
"<qso>\nfoo\n</qso>": FiftyOhmHtmlRenderer.render_tag_helper("qso", '<div class="qso_own">foo</div>\n', 1, 0)
+ "\n",
"<qso>\nfoo\n> bar\n</qso>": FiftyOhmHtmlRenderer.render_tag_helper(
"qso", '<div class="qso_own">foo</div>\n<div class="qso_other">bar</div>\n', 1, 0
)
+ "\n",
"<qso>\n*foo*\n> bar\n</qso>": FiftyOhmHtmlRenderer.render_tag_helper(
"qso", '<div class="qso_own"><em>foo</em></div>\n<div class="qso_other">bar</div>\n', 1, 0
)
+ "\n",
}
for assertion in assertions:
assert mistletoe.markdown(assertion, FiftyOhmHtmlRenderer) == assertions[assertion]
+1 -1
View File
@@ -14,7 +14,7 @@ def test_basic_units_html():
"0,12 V": "0,12&#8239;V",
"0,75 kW": "0,75&#8239;kW",
"33 A": "33&#8239;A",
"1 Ah": "1&#8239;Ah", # Ah can be a tricky case if the RegEx is wrong, as A might match before Ah, thus rendering the output with an "A" unit
"1 Ah": "1&#8239;Ah",
"10 A/mm²": "10&#8239;A/mm²",
"DL9MJ": "DL9MJ", # Ensure other strings, like callsings, aren‘t mistaken for units. ;)
"Ein Satz mit 200 V.": "Ein Satz mit 200&#8239;V.", # Support units before sentence ends.