Merge branch 'main' into bugfix/tipp
This commit is contained in:
@@ -3,8 +3,13 @@ import mistletoe
|
||||
from renderer.fifty_ohm_html_renderer import FiftyOhmHtmlRenderer
|
||||
from test.util import paragraph
|
||||
|
||||
def test_halfwidth_space_html():
|
||||
input = "Dies ist z.B. ein Test. D.h. hier sollten d.h. Spaces ersetzt worden sein."
|
||||
target = "Dies ist z. B. ein Test. D. h. hier sollten d. h. Spaces ersetzt worden sein."
|
||||
|
||||
assert mistletoe.markdown(input, FiftyOhmHtmlRenderer) == paragraph(target)
|
||||
def test_halfwidth_space_html():
|
||||
assertions = {
|
||||
"Dies ist z.B. ein Test. D.h. hier sollten d.h. Spaces ersetzt worden sein." : "Dies ist z. B. ein Test. D. h. hier sollten d. h. Spaces ersetzt worden sein.",
|
||||
"Dies ist z. B. ein Test. D. h. hier sollten d. h. Spaces ersetzt worden sein." : "Dies ist z. B. ein Test. D. h. hier sollten d. h. Spaces ersetzt worden sein.",
|
||||
"Z. B. die D.B. wird auch ersetzt, aber das macht nix." : "Z. B. die D. B. wird auch ersetzt, aber das macht nix."
|
||||
}
|
||||
|
||||
for key, value in assertions.items():
|
||||
assert mistletoe.markdown(key, FiftyOhmHtmlRenderer) == paragraph(value)
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import mistletoe
|
||||
|
||||
from renderer.fifty_ohm_html_renderer import FiftyOhmHtmlRenderer
|
||||
from test.util import paragraph
|
||||
|
||||
|
||||
def test_references_html():
|
||||
# Right now this tests only the default values.
|
||||
# The correct behavior can be tested when the information is added to the renderer class
|
||||
assertions = {
|
||||
"[ref:e_oszilloskop_bildschirmfoto_sinus]": '<a href="section.html#ref_e_oszilloskop_bildschirmfoto_sinus" onclick="highlightRef(\'e_oszilloskop_bildschirmfoto_sinus\');">0</a>',
|
||||
"[ref:n_rst_r]": '<a href="section.html#ref_n_rst_r" onclick="highlightRef(\'n_rst_r\');">0</a>',
|
||||
"[ref:Uuuuuh]": '<a href="section.html#ref_Uuuuuh" onclick="highlightRef(\'Uuuuuh\');">0</a>', # Test the default parameters
|
||||
}
|
||||
|
||||
for key, value in assertions.items():
|
||||
assert mistletoe.markdown(key, FiftyOhmHtmlRenderer) == paragraph(value)
|
||||
@@ -0,0 +1,45 @@
|
||||
import mistletoe
|
||||
import pytest
|
||||
|
||||
from renderer.fifty_ohm_html_renderer import FiftyOhmHtmlRenderer
|
||||
|
||||
from .util import paragraph
|
||||
|
||||
|
||||
@pytest.mark.html
|
||||
def test_basic_units_html():
|
||||
"""Test basic units: Insert non-breaking, smaller space."""
|
||||
assertions = {
|
||||
"1 V": "1 V",
|
||||
"0,12 V": "0,12 V",
|
||||
"0,75 kW": "0,75 kW",
|
||||
"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
|
||||
}
|
||||
|
||||
for input, output in assertions.items():
|
||||
assert mistletoe.markdown(input, FiftyOhmHtmlRenderer) == paragraph(output)
|
||||
|
||||
|
||||
@pytest.mark.html
|
||||
def test_translated_units_html():
|
||||
"""Test translated units: Replace Ohm with Ω."""
|
||||
assertions = {
|
||||
"50 Ohm": "50 Ω",
|
||||
"100 mOhm": "100 mΩ",
|
||||
}
|
||||
|
||||
for input, output in assertions.items():
|
||||
assert mistletoe.markdown(input, FiftyOhmHtmlRenderer) == paragraph(output)
|
||||
|
||||
|
||||
@pytest.mark.html
|
||||
def test_special_units_html():
|
||||
"""Test special units: Don't put space before ° and %."""
|
||||
assertions = {
|
||||
"100%": "100%",
|
||||
"42,24°": "42,24°",
|
||||
}
|
||||
|
||||
for input, output in assertions.items():
|
||||
assert mistletoe.markdown(input, FiftyOhmHtmlRenderer) == paragraph(output)
|
||||
+2
-2
@@ -1,2 +1,2 @@
|
||||
def paragraph(text) :
|
||||
return f'<p>{text}</p>\n'
|
||||
def paragraph(text):
|
||||
return f"<p>{text}</p>\n"
|
||||
|
||||
Reference in New Issue
Block a user