Skip to content

[python] add mock API tests for Azure.SpecialHeaders.ConditionalRequest - #10783

Merged
Yuchao Yan (msyyc) merged 3 commits into
mainfrom
copilot/add-test-case-for-pr-4336
May 25, 2026
Merged

Yuchao Yan (msyyc) merged 3 commits into
mainfrom
copilot/add-test-case-for-pr-4336

Conversation

Copilot AI commented May 25, 2026 •

Copy link
Copy Markdown
Contributor

Adds Python SDK mock API test coverage for the Azure.SpecialHeaders.ConditionalRequest Spector scenarios introduced in Azure/typespec-azure#4336, which exercise Azure.Core.eTag headers with both the standard names (If-Match, If-None-Match) and non-standard wire names (x-ms-blob-if-match, x-ms-blob-if-none-match).

Changes

  • Sync tests — tests/mock_api/azure/test_azure_special_headers_conditional_request.py: covers post_if_match, post_if_none_match, post_custom_if_match, post_custom_if_none_match against the generated ConditionalRequestClient.
  • Async tests — matching coverage under tests/mock_api/azure/asynctests/.
  • Changelog — internal Chronus entry for @typespec/http-client-python.

The scenarios are already shipped in the pinned @azure-tools/azure-http-specs@0.1.0-alpha.40, so no dependency bump is required.

Example

The tests drive the generated client via azure.core.MatchConditions, which the generated prep_if_match / prep_if_none_match helpers map onto the appropriate (standard or custom) header:

from azure.core import MatchConditions
from azure.specialheaders.conditionalrequest import ConditionalRequestClient

with ConditionalRequestClient() as client:
    # Sends If-Match: "valid"
    client.post_if_match(etag="valid", match_condition=MatchConditions.IfNotModified)
    # Sends x-ms-blob-if-none-match: "invalid"
    client.post_custom_if_none_match(etag="invalid", match_condition=MatchConditions.IfModified)

Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
Copilot AI changed the title [WIP] Add test case for pull request 4336 [python] add mock API tests for Azure.SpecialHeaders.ConditionalRequest May 25, 2026
@microsoft-github-policy-service microsoft-github-policy-service Bot added the emitter:client:python Issue for the Python client emitter: @typespec/http-client-python label May 25, 2026
Copilot AI requested a review from Yuchao Yan (msyyc) May 25, 2026 06:41
@msyyc
Yuchao Yan (msyyc) marked this pull request as ready for review May 25, 2026 07:13
@azure-sdk-automation

Copy link
Copy Markdown

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

@pkg-pr-new

pkg-pr-new Bot commented May 25, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/http-client-python@10783

commit: 4eeb73e

@github-actions

Copy link
Copy Markdown
Contributor

All changed packages have been documented.

  • ✅ @typespec/http-client-python
Show changes

@typespec/http-client-python - internal ✏️

Add mock API tests for Azure.SpecialHeaders.ConditionalRequest (eTag with standard and non-standard wire names).

@msyyc
Yuchao Yan (msyyc) added this pull request to the merge queue May 25, 2026
Merged via the queue into main with commit 6d6e0c1 May 25, 2026
36 checks passed
@msyyc
Yuchao Yan (msyyc) deleted the copilot/add-test-case-for-pr-4336 branch May 25, 2026 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:client:python Issue for the Python client emitter: @typespec/http-client-python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[python] add test case for https://github.com/Azure/typespec-azure/pull/4336

3 participants