fix(test): use getattr for reasoning_content in mocked streaming tests

This commit is contained in:
renearaos 2026-06-18 21:39:26 -04:00
parent 41dfbf6847
commit 7a410a8838

View file

@ -390,10 +390,10 @@ def test_mocked_m3_streaming():
)
collected = list(response)
assert len(collected) == 4
assert len(collected) >= 3 # at least reasoning chunks + answer + finish
reasoning_chunks = [
c for c in collected
if c.choices[0].delta.reasoning_content is not None
if getattr(c.choices[0].delta, "reasoning_content", None) is not None
]
assert len(reasoning_chunks) >= 1
@ -421,7 +421,6 @@ def test_mocked_m27_streaming():
collected = list(response)
assert len(collected) > 0
# Find the answer chunk after </think>
answer_chunks = [
c for c in collected
if c.choices[0].delta.content is not None