Skip to content

[python] Add test for client-doc spector scenario (Azure typespec-azure #4268)#10888

Merged
msyyc merged 8 commits into
mainfrom
copilot/add-test-case-for-pull-4268
Jun 10, 2026
Merged

[python] Add test for client-doc spector scenario (Azure typespec-azure #4268)#10888
msyyc merged 8 commits into
mainfrom
copilot/add-test-case-for-pull-4268

Conversation

Copilot AI commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Adds python SDK mock_api coverage for the spector cases introduced in Azure/typespec-azure#4268. Of the two new scenarios under azure/client-generator-core/, only client-doc is generatable by the python emitter (response-as-bool is already in SKIP_SPECS).

Changes

  • Tests — sync + async tests for the @clientDoc scenario:
    • harvest POST round-trip against the mock server.
    • @clientDoc append mode: Plant model docstring retains base doc and appends client-specific text.
    • @clientDoc replace mode: harvest operation docstring fully overrides the base doc.
    • Docstring assertions compare only the method/model description (extracted via split(":ivar")[0].strip() for the model and split(":param")[0].strip() for the operation), excluding the parameter docstrings.
  • Changeloginternal chronus entry for @typespec/http-client-python.

response-as-bool is intentionally skipped in the emitter regeneration config, so no client is generated and no test is added for it.

def test_harvest(client: ClientDocClient):
    body = models.Plant(name="Rose", species="Rosa")
    assert client.documentation.harvest(body) == body

def test_model_doc_appended():
    # @clientDoc in append mode keeps the base @doc and appends the client-specific text.
    doc = models.Plant.__doc__.split(":ivar")[0].strip()
    assert doc == "A plant in the garden. This model is used to represent a plant in the client SDK."

def test_operation_doc_replaced(client: ClientDocClient):
    # @clientDoc in replace mode overrides the base @doc completely.
    doc = client.documentation.harvest.__doc__.split(":param")[0].strip()
    assert doc == "Retrieves a plant from the garden by submitting its name."

Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
@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 Jun 4, 2026
Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
Copilot AI changed the title [WIP] Add test case for Azure typespec pull request 4268 [python] Add test for client-doc spector scenario (Azure typespec-azure #4268) Jun 4, 2026
Copilot finished work on behalf of msyyc June 4, 2026 09:19
Copilot AI requested a review from msyyc June 4, 2026 09:19
@msyyc

msyyc commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Copilot AI and others added 2 commits June 9, 2026 09:31
Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
…-for-pull-4268

# Conflicts:
#	packages/http-client-python/package-lock.json

Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>

Copilot AI commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

Resolved the merge conflicts with main. The only conflict was the version bump in packages/http-client-python/package-lock.json, which I aligned to 0.31.0 to match package.json. Merged in commit 3e6e6b8.

Copilot finished work on behalf of msyyc June 9, 2026 09:37
Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
Copilot finished work on behalf of msyyc June 10, 2026 04:01
Copilot AI requested a review from msyyc June 10, 2026 04:01
@msyyc msyyc marked this pull request as ready for review June 10, 2026 04:02
@pkg-pr-new

pkg-pr-new Bot commented Jun 10, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: af1b1fd

@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 test for the @clientDoc decorator spector case (azure/client-generator-core/client-doc).

@azure-sdk-automation

Copy link
Copy Markdown

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

@msyyc msyyc enabled auto-merge June 10, 2026 04:58
@msyyc msyyc added this pull request to the merge queue Jun 10, 2026
Merged via the queue into main with commit 99197b7 Jun 10, 2026
36 checks passed
@msyyc msyyc deleted the copilot/add-test-case-for-pull-4268 branch June 10, 2026 06:35
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/4268

3 participants