Empty tenancies, Abri rejections and ambiguous responses resolve like the other relay operations 🟩

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Daniel Roth 2026-07-06 13:32:13 +00:00
parent 203ffac01f
commit 3dd2dfe92c

View file

@ -226,15 +226,19 @@ class AbriClient:
@staticmethod
def _parse_tenancy_data(root: ET.Element) -> TenancyData:
tenancy = root.find("Tenancy")
tenancies = root.findall("Tenancy")
if tenancy is None:
if len(tenancies) != 1:
raise AbriResponseParseError(
"Tenancy element missing from relay response"
f"expected exactly one Tenancy element, found {len(tenancies)}"
)
tenancy = tenancies[0]
tenancy_reference = (tenancy.text or "").strip()
if not tenancy_reference:
raise AbriResponseParseError("Tenancy element missing its reference")
return TenancyData(
tenancy_reference=tenancy_reference,
tenants=tuple(