Skip to content

Commit 1a930ea

Browse files
adamtheturtleclaude
andcommitted
Fix mypy errors in timeout tests
Use keyword arguments for patch.object and pytest.raises to satisfy mypy's type checking. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 7f0990f commit 1a930ea

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

tests/test_query.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,11 @@ def slow_request(
136136

137137
with (
138138
patch.object(
139-
requests,
140-
"request",
139+
target=requests,
140+
attribute="request",
141141
side_effect=slow_request,
142142
),
143-
pytest.raises(requests.exceptions.Timeout),
143+
pytest.raises(expected_exception=requests.exceptions.Timeout),
144144
):
145145
cloud_reco_client.query(image=image)
146146

@@ -185,8 +185,8 @@ def slow_request(
185185
return original_request(*args, **kwargs) # type: ignore[arg-type]
186186

187187
with patch.object(
188-
requests,
189-
"request",
188+
target=requests,
189+
attribute="request",
190190
side_effect=slow_request,
191191
):
192192
# This should succeed because timeout is 1.0 > 0.5

tests/test_vws.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,11 @@ def slow_request(
166166

167167
with (
168168
patch.object(
169-
requests,
170-
"request",
169+
target=requests,
170+
attribute="request",
171171
side_effect=slow_request,
172172
),
173-
pytest.raises(requests.exceptions.Timeout),
173+
pytest.raises(expected_exception=requests.exceptions.Timeout),
174174
):
175175
vws_client.add_target(
176176
name="x",
@@ -208,8 +208,8 @@ def slow_request(
208208
return original_request(*args, **kwargs) # type: ignore[arg-type]
209209

210210
with patch.object(
211-
requests,
212-
"request",
211+
target=requests,
212+
attribute="request",
213213
side_effect=slow_request,
214214
):
215215
# This should succeed because timeout is 1.0 > 0.5

0 commit comments

Comments
 (0)