From 5a3b50eb506ced4eb62dbddf620a8c482841947e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 12 May 2026 23:08:31 +0000 Subject: [PATCH 1/3] Initial plan From d812b34191ae380cc6365abbf1ad896089d16a5c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 12 May 2026 23:15:03 +0000 Subject: [PATCH 2/3] test(python): add azure alternate-type mock api sync and async tests Agent-Logs-Url: https://github.com/microsoft/typespec/sessions/3531a98a-0030-4de8-a9db-79f4da5836e6 Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com> --- ...e-type-mock-api-test-2026-5-12-23-16-00.md | 7 +++ ...ent_generator_core_alternate_type_async.py | 55 +++++++++++++++++++ ...re_client_generator_core_alternate_type.py | 50 +++++++++++++++++ 3 files changed, 112 insertions(+) create mode 100644 .chronus/changes/add-python-alternate-type-mock-api-test-2026-5-12-23-16-00.md create mode 100644 packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_client_generator_core_alternate_type_async.py create mode 100644 packages/http-client-python/tests/mock_api/azure/test_azure_client_generator_core_alternate_type.py diff --git a/.chronus/changes/add-python-alternate-type-mock-api-test-2026-5-12-23-16-00.md b/.chronus/changes/add-python-alternate-type-mock-api-test-2026-5-12-23-16-00.md new file mode 100644 index 00000000000..e769fe03d94 --- /dev/null +++ b/.chronus/changes/add-python-alternate-type-mock-api-test-2026-5-12-23-16-00.md @@ -0,0 +1,7 @@ +--- +changeKind: internal +packages: + - "@typespec/http-client-python" +--- + +Add sync and async mock API tests for the azure/client-generator-core/alternate-type Spector scenario. diff --git a/packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_client_generator_core_alternate_type_async.py b/packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_client_generator_core_alternate_type_async.py new file mode 100644 index 00000000000..b741d5bad9e --- /dev/null +++ b/packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_client_generator_core_alternate_type_async.py @@ -0,0 +1,55 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +import geojson +import pytest +import pytest_asyncio +from specs.azure.clientgenerator.core.alternatetype import aio, models + +FEATURE = geojson.Feature( + geometry=geojson.Point((-122.25, 37.87)), + properties={ + "name": "A single point of interest", + "category": "landmark", + "elevation": 100, + }, + id="feature-1", +) + + +@pytest_asyncio.fixture +async def client(): + async with aio.AlternateTypeClient() as client: + yield client + + +@pytest.mark.asyncio +async def test_get_model(client: aio.AlternateTypeClient): + result = await client.external_type.get_model() + assert result == FEATURE + + +@pytest.mark.asyncio +async def test_put_model(client: aio.AlternateTypeClient): + await client.external_type.put_model(FEATURE) + + +@pytest.mark.asyncio +async def test_get_property(client: aio.AlternateTypeClient): + result = await client.external_type.get_property() + assert result == models.ModelWithFeatureProperty( + feature=FEATURE, + additional_property="extra", + ) + + +@pytest.mark.asyncio +async def test_put_property(client: aio.AlternateTypeClient): + await client.external_type.put_property( + models.ModelWithFeatureProperty( + feature=FEATURE, + additional_property="extra", + ) + ) diff --git a/packages/http-client-python/tests/mock_api/azure/test_azure_client_generator_core_alternate_type.py b/packages/http-client-python/tests/mock_api/azure/test_azure_client_generator_core_alternate_type.py new file mode 100644 index 00000000000..47faf6332a8 --- /dev/null +++ b/packages/http-client-python/tests/mock_api/azure/test_azure_client_generator_core_alternate_type.py @@ -0,0 +1,50 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +import geojson +import pytest +from specs.azure.clientgenerator.core.alternatetype import AlternateTypeClient, models + +FEATURE = geojson.Feature( + geometry=geojson.Point((-122.25, 37.87)), + properties={ + "name": "A single point of interest", + "category": "landmark", + "elevation": 100, + }, + id="feature-1", +) + + +@pytest.fixture +def client(): + with AlternateTypeClient() as client: + yield client + + +def test_get_model(client: AlternateTypeClient): + result = client.external_type.get_model() + assert result == FEATURE + + +def test_put_model(client: AlternateTypeClient): + client.external_type.put_model(FEATURE) + + +def test_get_property(client: AlternateTypeClient): + result = client.external_type.get_property() + assert result == models.ModelWithFeatureProperty( + feature=FEATURE, + additional_property="extra", + ) + + +def test_put_property(client: AlternateTypeClient): + client.external_type.put_property( + models.ModelWithFeatureProperty( + feature=FEATURE, + additional_property="extra", + ) + ) From b0c8778a9b9c4c8df290638db3ce3a2641f5806b Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Thu, 14 May 2026 14:28:26 +0800 Subject: [PATCH 3/3] Update add-python-alternate-type-mock-api-test-2026-5-12-23-16-00.md --- ...dd-python-alternate-type-mock-api-test-2026-5-12-23-16-00.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.chronus/changes/add-python-alternate-type-mock-api-test-2026-5-12-23-16-00.md b/.chronus/changes/add-python-alternate-type-mock-api-test-2026-5-12-23-16-00.md index e769fe03d94..47ce56ebe73 100644 --- a/.chronus/changes/add-python-alternate-type-mock-api-test-2026-5-12-23-16-00.md +++ b/.chronus/changes/add-python-alternate-type-mock-api-test-2026-5-12-23-16-00.md @@ -4,4 +4,4 @@ packages: - "@typespec/http-client-python" --- -Add sync and async mock API tests for the azure/client-generator-core/alternate-type Spector scenario. +Add sync and async mock API tests for the azure/client-generator-core/alternate-type Spector scenario