tei-core and tei-xml ship behaviour-driven tests that exercise happy and
unhappy paths. Core scenarios validate that header metadata can be assembled,
that blank revision notes are rejected, and that the body model preserves
paragraph/utterance/division order while rejecting empty utterances and invalid
division types. Additional cases demonstrate inline emphasis, rend-aware mixed
content, pause cues with duration metadata, and ensure empty <hi> segments
are rejected. Division-specific tests cover Div construction with validated
@type, List and Item assembly, Label prefix content, @n and
@corresp attribute handling on items, and xml:id uniqueness checks across
nested division content. The XML crate now tests title serialization,
full-document parsing, and XML emission: feature files cover successful
parsing, missing header errors, syntax failures triggered by truncated
documents, as well as emission of canonical minimal TEI output and the error
surfaced when a document sneaks in forbidden control characters. These tests
run alongside the unit suite, so developers receive fast feedback when
modifying the scaffolding. The tei-py suite layers on rstest-bdd scenarios
for the Python module, covering successful construction of Document from a
valid title, rejection of blank titles via ValueError, round-tripping markup
through the module-level helper, both directions of the MessagePack bridge, and
the new XML exchange APIs. Behaviour-driven coverage now parses canonical TEI
fixtures, rejects malformed payloads, emits canonical strings, and proves
forbidden characters bubble up as ValueError with an actionable message. New
dictionary scenarios cover happy-path decoding, missing fields, blank titles,
and the TypeError raised when to_dict is called with the wrong object. New
validation scenarios assert that duplicate xml:id values are rejected and
that utterance speakers must be declared when a profile cast exists, while
documents without a cast still pass validation.
The tei-serde crate now publishes a versioned JSON Schema for TeiDocument.
Its unit tests assert that the checked-in schema snapshot stays in sync with
the generated output, and its behaviour tests validate both happy paths
(serialized documents satisfy the schema) and unhappy paths (missing required
fields and unknown inline properties are rejected).
The tei-serde crate also includes property-based tests using proptest to
verify round-trip integrity between formats. These tests generate arbitrary
valid TeiDocument instances and confirm that serialization to JSON,
MessagePack, and XML preserves equality when deserialized. The property-based
test suite complements the example-based tests by exercising edge cases that
handwritten fixtures might miss, such as documents with many blocks, deeply
nested inline elements, and titles containing punctuation. Run make test to
execute all tests, including the property suite.