Skip to content

Commit 91cea6c

Browse files
fix else branch
1 parent 0f62288 commit 91cea6c

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

tests/integrations/pydantic_ai/test_pydantic_ai.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -523,8 +523,8 @@ async def test_agent_run_stream_events(
523523
if PYDANTIC_VERSION > (2,):
524524
async with test_agent.run_stream_events(
525525
["Message demonstrating the absence of truncation.", "Test input"]
526-
) as events:
527-
async for _ in events:
526+
) as stream_events:
527+
async for _ in stream_events:
528528
pass
529529
else:
530530
async for _ in test_agent.run_stream_events(
@@ -551,8 +551,13 @@ async def test_agent_run_stream_events(
551551
else:
552552
events = capture_events()
553553

554-
async for _ in test_agent.run_stream_events("Test input"):
555-
pass
554+
if PYDANTIC_VERSION > (2,):
555+
async with test_agent.run_stream_events("Test input") as stream_events:
556+
async for _ in stream_events:
557+
pass
558+
else:
559+
async for _ in test_agent.run_stream_events("Test input"):
560+
pass
556561

557562
(transaction,) = events
558563

0 commit comments

Comments
 (0)