Files
50ohm/test/test_unit.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

47 lines
1.3 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import pytest
from .util import paragraph, render_html
@pytest.mark.html
def test_basic_units_html():
"""Test basic units: Insert non-breaking, smaller space."""
assertions = {
"1 V": "1&#8239;V",
"0,12 V": "0,12&#8239;V",
"0,75 kW": "0,75&#8239;kW",
"33 A": "33&#8239;A",
"1 Ah": "1&#8239;Ah",
"10 A/mm²": "10&#8239;A/mm²",
"DL9MJ": "DL9MJ", # Ensure other strings, like callsings, aren‘t mistaken for units. ;)
"En mening med 200 V.": "En mening med 200&#8239;V.", # Support units before sentence ends.
}
for input, output in assertions.items():
assert render_html(input) == paragraph(output)
@pytest.mark.html
def test_translated_units_html():
"""Test translated units: Replace Ohm with Ω."""
assertions = {
"50 Ohm": "50&#8239;Ω",
"100 mOhm": "100&#8239;mΩ",
}
for input, output in assertions.items():
assert render_html(input) == paragraph(output)
@pytest.mark.html
def test_special_units_html():
"""Test special units: Don't put space before °; % gets a thin space (Swedish convention)."""
assertions = {
"100%": "100&#8239;%",
"100 %": "100&#8239;%",
"42,24°": "42,24°",
}
for input, output in assertions.items():
assert render_html(input) == paragraph(output)