Files
50ohm/test/test_nonbreaking_spaces.py
T
SuperminarenandClaude Sonnet 5.5 874838f525 Swedish adaptation: Instegscertifikat and HAREC
- Editions replaced by INSTEG, HAREC and UPPGRADERING (Instegscertifikat -> HAREC)
- Question pool optional; simulator, homework tool and solutions switch off without one
- All UI strings, templates, renderers and project JS localised to sv-SE
  (decimal comma, Swedish non-breaking-space rules, Å/Ä/Ö in Morse table)
- DARC branding, membership CTA and German links removed; attribution footer added
- Page names centralised in src/pages.py
- README and docs rewritten in Swedish

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-10 15:03:02 +02:00

64 lines
2.1 KiB
Python

import mistletoe
import pytest
from renderer.fifty_ohm_latex_renderer import FiftyOhmLaTeXRenderer
from test.util import paragraph, render_html
@pytest.mark.html
def test_paragraph_html():
input = "Se 2§ och kanske även 3 §."
target = "Se 2&#160;§ och kanske även 3&#160;§."
assert render_html(input) == paragraph(target)
@pytest.mark.html
def test_three_points_html():
assertions = {
"Idag åt jag ... till lunch.": "Idag åt jag&#160;...&#160;till lunch.",
"Niemals hätte ich gedacht, dass...ich ...nicht kann.": "Niemals hätte ich gedacht, dass...ich&#160;...nicht kann.", # noqa: E501
"Oh nein ...ein Pinguin.": "Oh nein&#160;...ein Pinguin.",
"Haha .. . Hahaha": "Haha .. . Hahaha",
}
for key, value in assertions.items():
assert render_html(key) == paragraph(value)
@pytest.mark.html
def test_chapter_and_ptsfs_html():
input = "Se 3 kap. 2 § och 4 st. samt PTSFS 2025:1 och Report 89."
target = "Se 3&#160;kap. 2&#160;§ och 4&#160;st. samt PTSFS&#160;2025:1 och Report&#160;89."
assert render_html(input) == paragraph(target)
@pytest.mark.latex
def test_paragraph_latex():
input = "Se 2§ och kanske även 3 §."
target = "\nSe 2~§ och kanske även 3~§.\n"
assert mistletoe.markdown(input, FiftyOhmLaTeXRenderer) == target
@pytest.mark.latex
def test_three_points_latex():
assertions = {
"Idag åt jag ... till lunch.": "\nIdag åt jag~...~till lunch.\n",
"Niemals hätte ich gedacht, dass...ich ...nicht kann.": "\nNiemals hätte ich gedacht, dass...ich~...nicht kann.\n", # noqa: E501
"Oh nein ...ein Pinguin.": "\nOh nein~...ein Pinguin.\n",
"Haha .. . Hahaha": "\nHaha .. . Hahaha\n",
}
for key, value in assertions.items():
assert mistletoe.markdown(key, FiftyOhmLaTeXRenderer) == value
@pytest.mark.latex
def test_chapter_and_ptsfs_latex():
input = "Se 3 kap. 2 § och 4 st. samt PTSFS 2025:1 och Report 89."
target = "\nSe 3~kap. 2~§ och 4~st. samt PTSFS~2025:1 och Report~89.\n"
assert mistletoe.markdown(input, FiftyOhmLaTeXRenderer) == target