betty.jinja2.test module

Provide Betty’s default Jinja2 tests.

class betty.jinja2.test.PluginTester[source]

Bases: Generic[_PluginT]

Provides tests for a specific plugin type.

__init__(plugin_type: type[_PluginT], plugin_type_name: str)[source]
tests() Mapping[str, Callable[..., bool]][source]

Get the available tests, keyed by test name.

class betty.jinja2.test.TestEntity[source]

Bases: IndependentFactory

Test if a value is an entity.

__init__(entity_type_id_to_type_mapping: PluginIdToTypeMapping[Entity])[source]
async classmethod new() Self[source]

Create a new instance.

betty.jinja2.test.test_date_range(value: Any) bool[source]

Test if a value is a date range.

betty.jinja2.test.test_end_of_life_event(event: Event) bool[source]

Test if an event is an end-of-life event.

betty.jinja2.test.test_has_file_references(value: Any) bool[source]

Test if a value has betty.ancestry.file_reference.FileReference entities associated with it.

Test if a value has external links associated with it.

betty.jinja2.test.test_image_supported_media_type(media_type: MediaType | None) bool[source]

Test if a media type is supported by the image API.

betty.jinja2.test.test_linked_data_dumpable(value: Any) bool[source]

Test if a value can be dumped to Linked Data.

betty.jinja2.test.test_start_of_life_event(event: Event) bool[source]

Test if an event is a start-of-life event.

betty.jinja2.test.test_subject_role(value: Any) bool[source]

Test if a presence role is that of Subject.

betty.jinja2.test.test_user_facing_entity(value: Any) bool[source]

Test if a value is an entity of a user-facing type.

betty.jinja2.test.test_witness_role(value: Any) bool[source]

Test if a presence role is that of Witness.

async betty.jinja2.test.tests() Mapping[str, Callable[..., bool]][source]

Define the available tests.

This is internal. It MAY be used anywhere in Betty’s source code, but MUST NOT be used by third-party code.