fix: tests for pictures

This commit is contained in:
Matthias Jung
2025-11-09 15:42:13 +01:00
parent f5e5c93ad3
commit f00f0481a9
2 changed files with 6 additions and 6 deletions
+2 -4
View File
@@ -199,11 +199,9 @@ class FiftyOhmHtmlRenderer(HtmlRenderer):
"""
def render_picture(self, token):
alt_text = "Alt-Text noch nicht verfügbar"
if self.picture_handler is not None:
alt_text = self.picture_handler(token.id)
if alt_text is None:
alt_text = "Alt-Text noch nicht verfügbar"
alt_text = self.picture_handler(token.id) or alt_text
return self.render_picture_helper(token.id, token.ref, token.text, token.number, alt_text)
+4 -2
View File
@@ -9,7 +9,9 @@ from test.util import paragraph
@pytest.mark.html
def test_picture_html():
assertions = {
"[picture:123:abc:Text]": FiftyOhmHtmlRenderer.render_picture_helper("123", "abc", "Text", "TODO"),
"[picture:0:abc:Text]": FiftyOhmHtmlRenderer.render_picture_helper(
"0", "abc", "Text", "TODO", "Alt-Text noch nicht verfügbar"
),
}
for assertion in assertions:
@@ -19,7 +21,7 @@ def test_picture_html():
@pytest.mark.latex
def test_picture_latex():
assertions = {
"[picture:123:abc:Text]": FiftyOhmLaTeXRenderer.render_picture_helper("123", "abc", "Text", "TODO"),
"[picture:0:abc:Text]": FiftyOhmLaTeXRenderer.render_picture_helper("0", "abc", "Text", "TODO"),
}
for assertion in assertions: