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:
@@ -52,8 +52,6 @@ class Unit(SpanToken):
|
|||||||
unit: str
|
unit: str
|
||||||
|
|
||||||
def __init__(self, match: re.Match):
|
def __init__(self, match: re.Match):
|
||||||
print("pattern", self.pattern)
|
|
||||||
|
|
||||||
self.value = match.group("value")
|
self.value = match.group("value")
|
||||||
self.prefix = match.group("prefix") or ""
|
self.prefix = match.group("prefix") or ""
|
||||||
self.unit = match.group("unit")
|
self.unit = match.group("unit")
|
||||||
|
|||||||
+10
-4
@@ -7,11 +7,17 @@ from renderer.fifty_ohm_html_renderer import FiftyOhmHtmlRenderer
|
|||||||
@pytest.mark.html
|
@pytest.mark.html
|
||||||
def test_table_html():
|
def test_table_html():
|
||||||
assertions = {
|
assertions = {
|
||||||
"<qso>\nfoo\n</qso>": FiftyOhmHtmlRenderer.render_tag_helper("qso", '<div class="qso_own">foo</div>', 1, 0) +"\n",
|
"<qso>\nfoo\n</qso>": FiftyOhmHtmlRenderer.render_tag_helper("qso", '<div class="qso_own">foo</div>\n', 1, 0)
|
||||||
"<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",
|
+ "\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> 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:
|
for assertion in assertions:
|
||||||
assert mistletoe.markdown(assertion, FiftyOhmHtmlRenderer) == assertions[assertion]
|
assert mistletoe.markdown(assertion, FiftyOhmHtmlRenderer) == assertions[assertion]
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@ def test_basic_units_html():
|
|||||||
"0,12 V": "0,12 V",
|
"0,12 V": "0,12 V",
|
||||||
"0,75 kW": "0,75 kW",
|
"0,75 kW": "0,75 kW",
|
||||||
"33 A": "33 A",
|
"33 A": "33 A",
|
||||||
"1 Ah": "1 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 Ah",
|
||||||
"10 A/mm²": "10 A/mm²",
|
"10 A/mm²": "10 A/mm²",
|
||||||
"DL9MJ": "DL9MJ", # Ensure other strings, like callsings, aren‘t mistaken for units. ;)
|
"DL9MJ": "DL9MJ", # Ensure other strings, like callsings, aren‘t mistaken for units. ;)
|
||||||
"Ein Satz mit 200 V.": "Ein Satz mit 200 V.", # Support units before sentence ends.
|
"Ein Satz mit 200 V.": "Ein Satz mit 200 V.", # Support units before sentence ends.
|
||||||
|
|||||||
Reference in New Issue
Block a user