mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-10 22:41:41 +00:00
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:
parent
c3d1504c1c
commit
fa80c28f81
1 changed files with 3 additions and 2 deletions
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue