betty.test_utils.jinja2 module - Betty documentation

Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
View this page
Toggle table of contents sidebar

# betty.test_utils.jinja2 module

Utilities for testing Jinja2 templates.

class betty.test_utils.jinja2.TemplateFileTestBase

  Bases: `_TemplateTestBase`

  A base class for testing Jinja2 template files.

  assert_template_file(*, data: MutableMapping[str, Any] | None = None, locale: Localey | None = None, autoescape: bool | None = None) → AsyncContextManager[tuple[str, Project]]

    Assert that a template file can be rendered.

  template: str

class betty.test_utils.jinja2.TemplateStringTestBase

  Bases: `_TemplateTestBase`

  A base class for testing Jinja2 template strings.

  assert_template_string(template: str, *, data: MutableMapping[str, Any] | None = None, locale: Localey | None = None, autoescape: bool | None = None) → AsyncContextManager[tuple[str, Project]]

    Assert that a template string can be rendered.

async betty.test_utils.jinja2.assert_betty_html(project: Project, url_path: str) → Path

  Assert that an entity’s HTML resource exists and is valid.

async betty.test_utils.jinja2.assert_betty_json(project: Project, url_path: str, def_name: str) → Path

  Assert that an entity’s JSON resource exists and is valid.

betty.test_utils.jinja2.assert_template_file(template: str, *, data: MutableMapping[str, Any] | None = None, locale: Localey | None = None, autoescape: bool | None = None, extensions: set[type[Extension]] | None = None) → AsyncContextManager[tuple[str, Project]]

  Assert that a template file can be rendered.

betty.test_utils.jinja2.assert_template_string(template: str, *, data: MutableMapping[str, Any] | None = None, locale: Localey | None = None, autoescape: bool | None = None, extensions: set[type[Extension]] | None = None) → AsyncContextManager[tuple[str, Project]]

  Assert that a template string can be rendered.