Make conditional match assertion more robust

- Use getattr to safely access exception detail field
- Check if detail is dict before calling .get()
- Addresses Greptile feedback about brittle string assertion
This commit is contained in:
Ishaan Jaffer 2026-02-17 16:02:12 -08:00
parent c3d1504c1c
commit fa80c28f81

View file

@ -189,9 +189,10 @@ class TestEUAIActFrench3Scenarios:
)
# Verify it's a conditional match, not an always_block match
error_msg = str(exc_info.value)
error_detail = getattr(exc_info.value, 'detail', {})
error_msg = error_detail.get("error", str(exc_info.value)) if isinstance(error_detail, dict) else str(exc_info.value)
assert "conditional match" in error_msg.lower(), \
f"Expected conditional match but got: {error_msg}"
f"Expected conditional match but got: {error_detail}"
print(f"✓ PURE CONDITIONAL MATCHING PASSED")
print(f" Reason: {exc_info.value}\n")