Skip to content

Commit 1e59fce

Browse files
committed
Pyright
1 parent ba7f1fd commit 1e59fce

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed

pydantic_ai_slim/pydantic_ai/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
ImageGenerationTool,
1515
MCPServerTool,
1616
MemoryTool,
17-
UrlContextTool,
17+
UrlContextTool, # pyright: ignore[reportDeprecated]
1818
WebFetchTool,
1919
WebSearchTool,
2020
WebSearchUserLocation,

tests/models/test_anthropic.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4431,12 +4431,12 @@ async def test_anthropic_web_fetch_tool_with_parameters():
44314431
assert web_fetch_tool_param is not None
44324432

44334433
# Verify all parameters are passed correctly
4434-
assert web_fetch_tool_param['type'] == 'web_fetch_20250910'
4435-
assert web_fetch_tool_param['max_uses'] == 5
4436-
assert web_fetch_tool_param['allowed_domains'] == ['example.com', 'ai.pydantic.dev']
4437-
assert web_fetch_tool_param['blocked_domains'] is None
4438-
assert web_fetch_tool_param['citations'] == {'enabled': True}
4439-
assert web_fetch_tool_param['max_content_tokens'] == 50000
4434+
assert web_fetch_tool_param.get('type') == 'web_fetch_20250910'
4435+
assert web_fetch_tool_param.get('max_uses') == 5
4436+
assert web_fetch_tool_param.get('allowed_domains') == ['example.com', 'ai.pydantic.dev']
4437+
assert web_fetch_tool_param.get('blocked_domains') is None
4438+
assert web_fetch_tool_param.get('citations') == {'enabled': True}
4439+
assert web_fetch_tool_param.get('max_content_tokens') == 50000
44404440

44414441

44424442
async def test_anthropic_web_fetch_tool_domain_filtering():
@@ -4464,8 +4464,8 @@ async def test_anthropic_web_fetch_tool_domain_filtering():
44644464
assert web_fetch_tool_param is not None
44654465

44664466
# Verify blocked_domains is passed correctly
4467-
assert web_fetch_tool_param['blocked_domains'] == ['private.example.com', 'internal.example.com']
4468-
assert web_fetch_tool_param['allowed_domains'] is None
4467+
assert web_fetch_tool_param.get('blocked_domains') == ['private.example.com', 'internal.example.com']
4468+
assert web_fetch_tool_param.get('allowed_domains') is None
44694469

44704470

44714471
@pytest.mark.vcr()

tests/models/test_google.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
from pydantic_ai.builtin_tools import (
4646
CodeExecutionTool,
4747
ImageGenerationTool,
48-
UrlContextTool,
48+
UrlContextTool, # pyright: ignore[reportDeprecated]
4949
WebFetchTool,
5050
WebSearchTool,
5151
)
@@ -1356,7 +1356,7 @@ async def test_google_model_web_fetch_tool(
13561356

13571357
if use_deprecated_url_context_tool:
13581358
with pytest.warns(DeprecationWarning, match='Use `WebFetchTool` instead.'):
1359-
tool = UrlContextTool()
1359+
tool = UrlContextTool() # pyright: ignore[reportDeprecated]
13601360
else:
13611361
tool = WebFetchTool()
13621362

tests/test_builtin_tools.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
import pytest
44

55
from pydantic_ai.agent import Agent
6-
from pydantic_ai.builtin_tools import CodeExecutionTool, UrlContextTool, WebSearchTool
6+
from pydantic_ai.builtin_tools import ( # pyright: ignore[reportDeprecated]
7+
CodeExecutionTool,
8+
UrlContextTool,
9+
WebSearchTool,
10+
)
711
from pydantic_ai.exceptions import UserError
812
from pydantic_ai.models import Model
913

@@ -45,4 +49,4 @@ async def test_builtin_tools_not_supported_code_execution_stream(model: Model, a
4549
def test_url_context_tool_is_deprecated():
4650
"""Test that UrlContextTool is deprecated and warns users to use WebFetchTool instead."""
4751
with pytest.warns(DeprecationWarning, match='Use `WebFetchTool` instead.'):
48-
UrlContextTool()
52+
UrlContextTool() # pyright: ignore[reportDeprecated]

0 commit comments

Comments
 (0)