Esempio n. 1
0
def render_page(page):
    """Render a page."""

    common_values = loadvalues(f"{SRC_DIR}/values")
    page_values = loadvalues(
        f"{SRC_DIR}/pages/{page}", extension_renderers=EXTENSION_RENDERERS
    )
    return render(document(p=page_values, c=common_values))
Esempio n. 2
0
def test_loadvalues():
    values = loadvalues("tests/assets/values/valid")
    assert values.a == "<p>a</p>"
    assert values.b == "1&lt;3&gt;2"
    assert values.c.d == '<p class="x">x</p>'
Esempio n. 3
0
def test_loadvalues_duplicate():
    with pytest.raises(NameError):
        loadvalues("tests/assets/values/invalid/duplicate")
Esempio n. 4
0
def test_loadvalues_no_ext():
    with pytest.raises(NameError):
        loadvalues("tests/assets/values/invalid/no_ext")
Esempio n. 5
0
def test_loadvalues_unsupported():
    with pytest.raises(TypeError):
        loadvalues("tests/assets/values/invalid/unsupported_type")