betty.jinja2.test module

Provide Betty’s default Jinja2 tests.

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

Test if a value is a date range.

Parameters:

value (typing.Any)

Return type:

bool

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

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

Parameters:

event (betty.model.ancestry.Event)

Return type:

bool

async betty.jinja2.test.test_entity(value: Any, entity_type_id: str | None = None) bool[source]

Test if a value is an entity.

Parameters:
  • entity_type_id (str | None) – If given, additionally ensure the value is an entity of this type.

  • value (typing.Any)

Return type:

bool

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

Test if a value has file entities associated with it.

Parameters:

value (typing.Any)

Return type:

bool

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

Test if a value is a generated entity ID, or if it is an entity and has a generated entity ID.

Parameters:

value (typing.Any)

Return type:

bool

Test if a value has external links associated with it.

Parameters:

value (typing.Any)

Return type:

bool

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

Test if a value can be dumped to Linked Data.

Parameters:

value (typing.Any)

Return type:

bool

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

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

Parameters:

event (betty.model.ancestry.Event)

Return type:

bool

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

Test if a presence role is that of Subject.

Parameters:

value (typing.Any)

Return type:

bool

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

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

Parameters:

value (typing.Any)

Return type:

bool

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

Test if a presence role is that of Witness.

Parameters:

value (typing.Any)

Return type:

bool