diff --git a/.chronus/changes/python-add-response-as-bool-test-2026-6-10-5-33-0.md b/.chronus/changes/python-add-response-as-bool-test-2026-6-10-5-33-0.md new file mode 100644 index 00000000000..9c5937cf445 --- /dev/null +++ b/.chronus/changes/python-add-response-as-bool-test-2026-6-10-5-33-0.md @@ -0,0 +1,7 @@ +--- +changeKind: internal +packages: + - "@typespec/http-client-python" +--- + +Add mock api test for azure client-generator-core response-as-bool spector case diff --git a/packages/http-client-python/eng/scripts/ci/regenerate-common.ts b/packages/http-client-python/eng/scripts/ci/regenerate-common.ts index 1fe6f17d63c..5ae8809eec8 100644 --- a/packages/http-client-python/eng/scripts/ci/regenerate-common.ts +++ b/packages/http-client-python/eng/scripts/ci/regenerate-common.ts @@ -73,7 +73,6 @@ export interface BuildTaskGroupsOptions { export const SKIP_SPECS: string[] = [ "type/file", "service/multiple-services", - "azure/client-generator-core/response-as-bool", ]; export const SpecialFlags: Record> = { diff --git a/packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_client_generator_core_response_as_bool_async.py b/packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_client_generator_core_response_as_bool_async.py new file mode 100644 index 00000000000..9df21cc96d8 --- /dev/null +++ b/packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_client_generator_core_response_as_bool_async.py @@ -0,0 +1,24 @@ +# ------------------------------------------------------------------------- +# 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.responseasbool.aio import ResponseAsBoolClient + + +@pytest_asyncio.fixture +async def client(): + async with ResponseAsBoolClient() as client: + yield client + + +@pytest.mark.asyncio +async def test_exists(client: ResponseAsBoolClient): + assert await client.head_as_boolean.exists() is True + + +@pytest.mark.asyncio +async def test_not_exists(client: ResponseAsBoolClient): + assert await client.head_as_boolean.not_exists() is False diff --git a/packages/http-client-python/tests/mock_api/azure/test_azure_client_generator_core_response_as_bool.py b/packages/http-client-python/tests/mock_api/azure/test_azure_client_generator_core_response_as_bool.py new file mode 100644 index 00000000000..e37a641ce11 --- /dev/null +++ b/packages/http-client-python/tests/mock_api/azure/test_azure_client_generator_core_response_as_bool.py @@ -0,0 +1,21 @@ +# ------------------------------------------------------------------------- +# 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.responseasbool import ResponseAsBoolClient + + +@pytest.fixture +def client(): + with ResponseAsBoolClient() as client: + yield client + + +def test_exists(client: ResponseAsBoolClient): + assert client.head_as_boolean.exists() is True + + +def test_not_exists(client: ResponseAsBoolClient): + assert client.head_as_boolean.not_exists() is False