Repository navigation
[python] Add test for client-doc spector scenario (Azure typespec-azure #4268) - #10888
Merged
Merged
Conversation
Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
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
Contributor
|
Copilot resolve the merge conflicts in this pull request |
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>
Contributor
Author
Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
Yuchao Yan (msyyc)
marked this pull request as ready for review
June 10, 2026 04:02
Yuchao Yan (msyyc)
requested review from
iscai-msft and
Chenjie Shi (tadelesh)
as code owners
June 10, 2026 04:02
commit: |
Contributor
|
All changed packages have been documented.
Show changes
|
|
You can try these changes here
|
Yuchao Yan (msyyc)
enabled auto-merge
June 10, 2026 04:58
Yuchao Yan (msyyc)
approved these changes
Jun 10, 2026
Chenxi Jiang (ChenxiJiang333)
approved these changes
Jun 10, 2026
jenny (JennyPng)
pushed a commit
to JennyPng/typespec
that referenced
this pull request
Jun 10, 2026
microsoft#4268) (microsoft#10888) 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. - **Changelog** — `internal` 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. ```python 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: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com> Co-authored-by: Yuchao Yan <yuchaoyan@microsoft.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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/, onlyclient-docis generatable by the python emitter (response-as-boolis already inSKIP_SPECS).Changes
@clientDocscenario:harvestPOST round-trip against the mock server.@clientDocappend mode:Plantmodel docstring retains base doc and appends client-specific text.@clientDocreplace mode:harvestoperation docstring fully overrides the base doc.split(":ivar")[0].strip()for the model andsplit(":param")[0].strip()for the operation), excluding the parameter docstrings.internalchronus entry for@typespec/http-client-python.response-as-boolis intentionally skipped in the emitter regeneration config, so no client is generated and no test is added for it.