From 952ccaf7e92f76c0ba3974153371f62a414b2fbe Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 4 Jun 2026 09:09:34 +0000 Subject: [PATCH 1/3] Initial plan From 1d4e7b4e37565d97321b05c0d5d1f7a4f245dfc2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 4 Jun 2026 09:14:01 +0000 Subject: [PATCH 2/3] Plan: add python tests for client-doc and response-as-bool spector cases Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com> --- packages/http-client-python/package-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/http-client-python/package-lock.json b/packages/http-client-python/package-lock.json index abed8fc89d7..9f3003270fb 100644 --- a/packages/http-client-python/package-lock.json +++ b/packages/http-client-python/package-lock.json @@ -1,12 +1,12 @@ { "name": "@typespec/http-client-python", - "version": "0.30.0", + "version": "0.30.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@typespec/http-client-python", - "version": "0.30.0", + "version": "0.30.1", "hasInstallScript": true, "license": "MIT", "dependencies": { From 175dd91951ff170c62b55155a883cf1d0f382348 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 4 Jun 2026 09:18:30 +0000 Subject: [PATCH 3/3] Add python tests for client-doc spector case (Azure PR #4268) Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com> --- .../python-client-doc-test-2026-6-4-9-30-0.md | 7 ++++ ..._client_generator_core_client_doc_async.py | 34 +++++++++++++++++++ ..._azure_client_generator_core_client_doc.py | 31 +++++++++++++++++ 3 files changed, 72 insertions(+) create mode 100644 .chronus/changes/python-client-doc-test-2026-6-4-9-30-0.md create mode 100644 packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_client_generator_core_client_doc_async.py create mode 100644 packages/http-client-python/tests/mock_api/azure/test_azure_client_generator_core_client_doc.py diff --git a/.chronus/changes/python-client-doc-test-2026-6-4-9-30-0.md b/.chronus/changes/python-client-doc-test-2026-6-4-9-30-0.md new file mode 100644 index 00000000000..84dd98fac83 --- /dev/null +++ b/.chronus/changes/python-client-doc-test-2026-6-4-9-30-0.md @@ -0,0 +1,7 @@ +--- +changeKind: internal +packages: + - "@typespec/http-client-python" +--- + +Add test for the `@clientDoc` decorator spector case (azure/client-generator-core/client-doc). diff --git a/packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_client_generator_core_client_doc_async.py b/packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_client_generator_core_client_doc_async.py new file mode 100644 index 00000000000..b9334c6f4cf --- /dev/null +++ b/packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_client_generator_core_client_doc_async.py @@ -0,0 +1,34 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +import pytest +import pytest_asyncio +from specs.azure.clientgenerator.core.clientdoc.aio import ClientDocClient +from specs.azure.clientgenerator.core.clientdoc import models + + +@pytest_asyncio.fixture +async def client(): + async with ClientDocClient() as client: + yield client + + +@pytest.mark.asyncio +async def test_harvest(client: ClientDocClient): + body = models.Plant(name="Rose", species="Rosa") + assert await client.documentation.harvest(body) == body + + +def test_model_doc_appended(): + # @clientDoc in append mode keeps the base @doc and appends the client-specific text. + assert "A plant in the garden." in models.Plant.__doc__ + assert "This model is used to represent a plant in the client SDK." in models.Plant.__doc__ + + +@pytest.mark.asyncio +async def test_operation_doc_replaced(client: ClientDocClient): + # @clientDoc in replace mode overrides the base @doc completely. + assert "Retrieves a plant from the garden by submitting its name." in client.documentation.harvest.__doc__ + assert "Internal operation to get a plant." not in client.documentation.harvest.__doc__ diff --git a/packages/http-client-python/tests/mock_api/azure/test_azure_client_generator_core_client_doc.py b/packages/http-client-python/tests/mock_api/azure/test_azure_client_generator_core_client_doc.py new file mode 100644 index 00000000000..299360a9e85 --- /dev/null +++ b/packages/http-client-python/tests/mock_api/azure/test_azure_client_generator_core_client_doc.py @@ -0,0 +1,31 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +import pytest +from specs.azure.clientgenerator.core.clientdoc import ClientDocClient +from specs.azure.clientgenerator.core.clientdoc import models + + +@pytest.fixture +def client(): + with ClientDocClient() as client: + yield client + + +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. + assert "A plant in the garden." in models.Plant.__doc__ + assert "This model is used to represent a plant in the client SDK." in models.Plant.__doc__ + + +def test_operation_doc_replaced(client: ClientDocClient): + # @clientDoc in replace mode overrides the base @doc completely. + assert "Retrieves a plant from the garden by submitting its name." in client.documentation.harvest.__doc__ + assert "Internal operation to get a plant." not in client.documentation.harvest.__doc__