Skip to content

Commit 4f31ecb

Browse files
DouweMclaude
andcommitted
fix: narrow pragma: no cover to specific uncovered lines
The allow_partial branch is partially covered (line 181 runs during streaming). Move pragma to the specific inner branch that isn't covered (wrap_validation_errors + ValidationError case). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d0f7a72 commit 4f31ecb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pydantic_ai_slim/pydantic_ai/_output.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ async def run_output_validate_hooks(
174174
run_context, raw_output=raw_output, output_context=output_context, handler=do_validate
175175
)
176176
except (ValidationError, ModelRetry) as e:
177-
if allow_partial: # pragma: no cover — partial validation errors during streaming are caught by stream_output
178-
if wrap_validation_errors and isinstance(e, ValidationError):
177+
if allow_partial:
178+
if wrap_validation_errors and isinstance(e, ValidationError): # pragma: no cover
179179
m = _messages.RetryPromptPart(content=e.errors(include_url=False))
180180
raise ToolRetryError(m) from e
181181
raise

0 commit comments

Comments
 (0)