Skip to content

Commit 10c24a6

Browse files
committed
Fix lint errors and remove orphaned mocks
- Remove duplicate IsStr imports (already imported from dirty_equals) - Remove orphaned book_flight/authenticate_with_airline mocks from removed example
1 parent c5527af commit 10c24a6

File tree

4 files changed

+3
-28
lines changed

4 files changed

+3
-28
lines changed

tests/test_agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
from pydantic_ai.tools import DeferredToolRequests, DeferredToolResults, ToolDefinition, ToolDenied
6767
from pydantic_ai.usage import RequestUsage
6868

69-
from .conftest import IsDatetime, IsNow, IsStr, TestEnv
69+
from .conftest import IsDatetime, IsNow, TestEnv
7070

7171
pytestmark = pytest.mark.anyio
7272

tests/test_examples.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -711,21 +711,6 @@ async def model_logic( # noqa: C901
711711
TextPart(content='The factorial of 15 is **1,307,674,368,000**.'),
712712
]
713713
)
714-
elif m.content == 'Book a flight to Lisbon, Portugal and link my SkyWay Airlines account':
715-
return ModelResponse(
716-
parts=[
717-
ToolCallPart(
718-
tool_name='book_flight',
719-
args={'destination': 'Lisbon, Portugal'},
720-
tool_call_id='pyd_ai_tool_call_id_1',
721-
),
722-
ToolCallPart(
723-
tool_name='authenticate_with_airline',
724-
args={'airline': 'SkyWay Airlines'},
725-
tool_call_id='pyd_ai_tool_call_id_2',
726-
),
727-
]
728-
)
729714

730715
elif isinstance(m, ToolReturnPart) and m.tool_name == 'roulette_wheel':
731716
win = m.content == 'winner'
@@ -889,16 +874,6 @@ async def model_logic( # noqa: C901
889874
return ModelResponse(
890875
parts=[TextPart('The answer to the ultimate question of life, the universe, and everything is 42.')]
891876
)
892-
elif isinstance(m, ToolReturnPart) and m.tool_name in ('book_flight', 'authenticate_with_airline'):
893-
# After deferred tools complete, check if we have all results to provide final response
894-
tool_names = {part.tool_name for msg in messages for part in msg.parts if isinstance(part, ToolReturnPart)}
895-
if 'book_flight' in tool_names and 'authenticate_with_airline' in tool_names:
896-
return ModelResponse(
897-
parts=[TextPart('Flight to Lisbon booked successfully and your SkyWay Airlines account is now linked.')]
898-
)
899-
# If we don't have both results yet, just acknowledge the tool result
900-
return ModelResponse(parts=[TextPart(f'Received result from {m.tool_name}')])
901-
902877
if isinstance(m, ToolReturnPart):
903878
sys.stdout.write(str(debug.format(messages, info)))
904879
raise RuntimeError(f'Unexpected message: {m}')

tests/test_streaming.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
from pydantic_ai.usage import RequestUsage
5252
from pydantic_graph import End
5353

54-
from .conftest import IsDatetime, IsInt, IsNow, IsStr
54+
from .conftest import IsDatetime, IsInt, IsNow
5555

5656
pytestmark = pytest.mark.anyio
5757

tests/test_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
from pydantic_ai.tools import DeferredToolRequests, DeferredToolResults, ToolApproved, ToolDefinition, ToolDenied
4040
from pydantic_ai.usage import RequestUsage
4141

42-
from .conftest import IsDatetime, IsStr
42+
from .conftest import IsDatetime
4343

4444

4545
def test_tool_no_ctx():

0 commit comments

Comments
 (0)