Files
agent-framework/python/packages/core/tests
T
Evan Mattson c4f643a750 Python: Fix walrus operator precedence for model_id kwarg in AzureOpenAIResponsesClient (#4310)
* Fix walrus operator precedence for model_id in AzureOpenAIResponsesClient (#4299)

Add parentheses around the walrus assignment so model_id receives the
actual string value instead of the boolean result of
`kwargs.pop(...) and not deployment_name`.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Address review: replace walrus with explicit None check, add edge-case tests (#4299)

- Replace walrus operator with explicit assignment and 'is not None'
  check to avoid boolean-coercion pitfalls (empty string now correctly
  surfaces as ValueError instead of silently falling back)
- Add test: deployment_name takes precedence over model_id kwarg
- Add test: model_id='' raises ValueError
- Add test: model_id=None falls back to env var

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Add explicit validation for empty model_id in AzureOpenAIResponsesClient

Reject empty or whitespace-only model_id with ValueError instead of
silently passing an empty deployment name downstream. This ensures the
test_init_model_id_kwarg_empty_string test correctly validates behavior
defined in production code rather than relying on downstream validation.

Addresses PR review feedback for #4299.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Simplify model_id handling using walrus operator

Addresses review comment on PR #4310.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Restore explicit model_id validation to fix test failures (#4299)

The walrus operator refactor silently dropped the empty-string validation,
causing test_init_model_id_kwarg_empty_string to fail. Restore the explicit
None check and ValueError raise for empty model_id.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Revert "Restore explicit model_id validation to fix test failures (#4299)"

This reverts commit 1d2965fff6.

* Revert to walrus operator fix per review feedback

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
c4f643a750 ยท 2026-03-02 14:06:58 +00:00
History
..