moo.agent.tests.test_lore
Tests for moo/agent/lore.py.
The curation is pure functions exercised directly; LoreClient is driven by a
fake MCP server so the assembly, canonical preference, and graceful-failure
paths are covered without a live krustylu endpoint. No DJANGO_SETTINGS_MODULE.
Functions
|
build_character_brief prefers display_name and shows gender plus the slug token. |
|
Sections with no data are omitted rather than rendered empty. |
|
build_room_brief renders all sections and truncates an over-long dialogue line. |
|
condense_description keeps the intro, drops links, and stops at the first heading. |
|
An empty description condenses to an empty string. |
|
A long description is clipped near max_chars, preferring a sentence end. |
|
With no open session, lookups return empty without raising. |
|
A raising MCP call is caught and reported as an empty result. |
|
_resolve picks the canonical row even when a variant ranks first. |
|
LoreClient.room_brief resolves a location and folds the queries into a brief. |
|
A location that resolves to nothing yields an empty string, not an error. |
|
sanitize_query strips the quote chars that break krustylu's FTS parser. |
|
strip_md_links reduces [label](url) and [label](url "title") to the label. |
|
top_speaker_ids ranks by count, drops null character ids, and honors the limit. |