feature: add metadata and translation
This commit is contained in:
+15752
File diff suppressed because it is too large
Load Diff
+5
-1
@@ -1,10 +1,14 @@
|
||||
import json
|
||||
|
||||
from mistletoe import Document
|
||||
|
||||
from renderer.fifty_ohm_html_renderer import FiftyOhmHtmlRenderer
|
||||
|
||||
|
||||
def question_stub(input):
|
||||
return f"<question>{input}</question>" # TODO implement this stub
|
||||
with open('data/metadata.json') as file:
|
||||
metadata = json.load(file)
|
||||
return metadata[f"{input}"].get("number")
|
||||
|
||||
|
||||
def test_html(capsys):
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import json
|
||||
|
||||
import pytest
|
||||
from mistletoe import Document
|
||||
|
||||
@@ -22,6 +24,24 @@ def test_comment_html():
|
||||
for assertion in assertions:
|
||||
assert renderer.render(Document(assertion)) == assertions[assertion]
|
||||
|
||||
@pytest.mark.html
|
||||
def test_comment_translation_html():
|
||||
assertions = {
|
||||
"[question:123]": "ED111\n",
|
||||
"\n[question:123]\n": "ED111\n",
|
||||
"\n[question:123]\n[question:123]": "ED111\nED111\n",
|
||||
"Foo\n[question:123]\nBar": paragraph("Foo") + "ED111\n" + paragraph("Bar"),
|
||||
}
|
||||
|
||||
def test_function(input):
|
||||
with open('data/metadata.json') as file:
|
||||
metadata = json.load(file)
|
||||
return metadata[f"{input}"].get("number")
|
||||
|
||||
with FiftyOhmHtmlRenderer(test_function) as renderer:
|
||||
for assertion in assertions:
|
||||
assert renderer.render(Document(assertion)) == assertions[assertion]
|
||||
|
||||
|
||||
@pytest.mark.latex
|
||||
def test_comment_latex():
|
||||
|
||||
Reference in New Issue
Block a user