Handle structured conference metadata
This commit is contained in:
parent
d1c2c51776
commit
9958632242
2 changed files with 85 additions and 7 deletions
|
|
@ -174,6 +174,41 @@ def test_validate_generated_conference_reports_missing_dates() -> None:
|
|||
add_new_conference.validate_generated_conference(conf)
|
||||
|
||||
|
||||
def test_webpage_to_text_includes_hidden_event_metadata() -> None:
|
||||
"""Schema.org event metadata should be included even when visually hidden."""
|
||||
root = lxml.html.fromstring("""
|
||||
<html><body>
|
||||
<div style="display:none" itemscope itemtype="http://schema.org/Event">
|
||||
<meta itemprop="name" content="State of the Map Asia 2026 OSAKA">
|
||||
<meta itemprop="startDate" content="2026-09-06T18:30">
|
||||
</div>
|
||||
</body></html>
|
||||
""")
|
||||
|
||||
text = add_new_conference.webpage_to_text(root)
|
||||
|
||||
assert "- name: State of the Map Asia 2026 OSAKA" in text
|
||||
assert "- startDate: 2026-09-06T18:30" in text
|
||||
|
||||
|
||||
def test_apply_event_metadata_dates_fills_missing_generated_dates() -> None:
|
||||
"""Structured page dates should recover incomplete model output."""
|
||||
root = lxml.html.fromstring("""
|
||||
<div itemscope itemtype="http://schema.org/Event">
|
||||
<meta itemprop="startDate" content="2026-09-06T18:30">
|
||||
</div>
|
||||
""")
|
||||
conf: dict[str, typing.Any] = {"name": "State of the Map Asia 2026"}
|
||||
|
||||
add_new_conference.apply_event_metadata_dates(conf, root)
|
||||
|
||||
assert conf["dates"] == {
|
||||
"status": "exact",
|
||||
"start": datetime(2026, 9, 6, 18, 30),
|
||||
"end": datetime(2026, 9, 6, 18, 30),
|
||||
}
|
||||
|
||||
|
||||
def test_build_prompt_includes_nested_dates_and_series() -> None:
|
||||
"""The prompt should describe nested dates and known series IDs."""
|
||||
prompt = add_new_conference.build_prompt(
|
||||
|
|
@ -194,6 +229,8 @@ def test_build_prompt_includes_nested_dates_and_series() -> None:
|
|||
assert "dates.status" in prompt
|
||||
assert "- pycascades: PyCascades" in prompt
|
||||
assert "March 2027" in prompt
|
||||
assert "For an address written in a non-Latin script" in prompt
|
||||
assert "If no reliable rendering is available, omit" in prompt
|
||||
|
||||
|
||||
def test_validate_country_normalises_name() -> None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue