Skip to content

Commit 8bb5370

Browse files
ronakrmclaude
andcommitted
Fix pyright type checking errors in tests
- Add explicit list[ModelMessage] type annotations in test_instrumented.py - Fix pyright ignore comment placement in test_openai.py - Remove unnecessary type ignore comments Fixes CI pyright errors reported on Python 3.10 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 6f29370 commit 8bb5370

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

tests/models/test_instrumented.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,7 +1643,7 @@ def test_cache_point_in_user_prompt():
16431643
)
16441644

16451645
# Test with multiple CachePoints
1646-
messages_multi = [
1646+
messages_multi: list[ModelMessage] = [
16471647
ModelRequest(
16481648
parts=[
16491649
UserPromptPart(content=['first', CachePoint(), 'second', CachePoint(), 'third']),
@@ -1664,7 +1664,7 @@ def test_cache_point_in_user_prompt():
16641664
)
16651665

16661666
# Test with CachePoint mixed with other content types
1667-
messages_mixed = [
1667+
messages_mixed: list[ModelMessage] = [
16681668
ModelRequest(
16691669
parts=[
16701670
UserPromptPart(

tests/models/test_openai.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3076,12 +3076,12 @@ async def test_cache_point_filtering(allow_model_requests: None):
30763076
async def test_cache_point_filtering_responses_model():
30773077
"""Test that CachePoint is filtered out in OpenAI Responses API requests."""
30783078
# Test the static method directly to trigger line 1680
3079-
msg = await OpenAIResponsesModel._map_user_prompt(
3079+
msg = await OpenAIResponsesModel._map_user_prompt( # pyright: ignore[reportPrivateUsage]
30803080
UserPromptPart(content=['text before', CachePoint(), 'text after'])
3081-
) # pyright: ignore[reportPrivateUsage]
3081+
)
30823082

30833083
# CachePoint should be filtered out, only text content should remain
30843084
assert msg['role'] == 'user'
3085-
assert len(msg['content']) == 2 # type: ignore[reportUnknownArgumentType]
3085+
assert len(msg['content']) == 2
30863086
assert msg['content'][0]['text'] == 'text before' # type: ignore[reportUnknownArgumentType]
30873087
assert msg['content'][1]['text'] == 'text after' # type: ignore[reportUnknownArgumentType]

0 commit comments

Comments
 (0)