From 2b29fe0655678b6724625f3cbe473eab132ebf6c Mon Sep 17 00:00:00 2001 From: ChenxiJiang333 <119990644+ChenxiJiang333@users.noreply.github.com> Date: Thu, 12 Sep 2024 12:40:13 +0800 Subject: [PATCH] add testcases (#2822) * add testcases * Update requirements.txt * add changelog * add changelog --------- Co-authored-by: Yuchao Yan --- .../add-testcase-2024-8-11-16-36-42.md | 7 + .../test_azure_arm_models_resource_async.py | 73 ++++ .../asynctests/test_azure_core_basic_async.py | 6 + .../test_azure_arm_models_resource.py | 66 ++++ .../mock_api_tests/test_azure_core_basic.py | 5 + .../test/azure/requirements.txt | 1 + .../asynctests/test_encode_numeric_async.py | 7 + .../asynctests/test_routes_async.py | 331 ++++++++++++++++++ .../test_encode_numeric.py | 6 + .../generic_mock_api_tests/test_routes.py | 285 +++++++++++++++ .../test/unbranded/requirements.txt | 1 + 11 files changed, 788 insertions(+) create mode 100644 .chronus/changes/add-testcase-2024-8-11-16-36-42.md create mode 100644 packages/typespec-python/test/generic_mock_api_tests/asynctests/test_routes_async.py create mode 100644 packages/typespec-python/test/generic_mock_api_tests/test_routes.py diff --git a/.chronus/changes/add-testcase-2024-8-11-16-36-42.md b/.chronus/changes/add-testcase-2024-8-11-16-36-42.md new file mode 100644 index 0000000000..d747181544 --- /dev/null +++ b/.chronus/changes/add-testcase-2024-8-11-16-36-42.md @@ -0,0 +1,7 @@ +--- +changeKind: internal +packages: + - "@azure-tools/typespec-python" +--- + +Add testcases for several cadl-ranch scenarios \ No newline at end of file diff --git a/packages/typespec-python/test/azure/mock_api_tests/asynctests/test_azure_arm_models_resource_async.py b/packages/typespec-python/test/azure/mock_api_tests/asynctests/test_azure_arm_models_resource_async.py index 4e7dfacd97..37c449f6a2 100644 --- a/packages/typespec-python/test/azure/mock_api_tests/asynctests/test_azure_arm_models_resource_async.py +++ b/packages/typespec-python/test/azure/mock_api_tests/asynctests/test_azure_arm_models_resource_async.py @@ -209,3 +209,76 @@ async def test_nested_proxy_resources_list_by_top_level_tracked_resource(client) assert result.name == "nested" assert result.type == "Azure.ResourceManager.Models.Resources/topLevelTrackedResources/top/nestedProxyResources" assert result.system_data.created_by == "AzureSDK" + + +@pytest.mark.asyncio +async def test_top_level_tracked_resources_action_sync(client): + await client.top_level_tracked_resources.action_sync( + resource_group_name=RESOURCE_GROUP_NAME, + top_level_tracked_resource_name="top", + body={"message": "Resource action at top level.", "urgent": True}, + ) + + +@pytest.mark.asyncio +async def test_singleton_tracked_resources_get_by_resource_group(client): + result = await client.singleton_tracked_resources.get_by_resource_group( + resource_group_name=RESOURCE_GROUP_NAME, + ) + assert result.properties.description == "valid" + assert result.properties.provisioning_state == "Succeeded" + assert result.name == "default" + assert result.type == "Azure.ResourceManager.Models.Resources/singletonTrackedResources" + assert result.system_data.created_by == "AzureSDK" + + +@pytest.mark.asyncio +async def test_singleton_tracked_resources_begin_create_or_replace(client): + result = await ( + await client.singleton_tracked_resources.begin_create_or_update( + resource_group_name=RESOURCE_GROUP_NAME, + resource=models.SingletonTrackedResource( + location="eastus", + properties=models.SingletonTrackedResourceProperties( + models.SingletonTrackedResourceProperties(description="valid") + ), + ), + ) + ).result() + assert result.properties.description == "valid" + assert result.properties.provisioning_state == "Succeeded" + assert result.name == "default" + assert result.type == "Azure.ResourceManager.Models.Resources/singletonTrackedResources" + assert result.system_data.created_by == "AzureSDK" + + +@pytest.mark.asyncio +async def test_singleton_tracked_resources_update(client): + result = await client.singleton_tracked_resources.update( + resource_group_name=RESOURCE_GROUP_NAME, + properties=models.SingletonTrackedResource( + location="eastus2", + properties=models.SingletonTrackedResourceProperties( + models.SingletonTrackedResourceProperties(description="valid2") + ), + ), + ) + assert result.properties.description == "valid2" + assert result.properties.provisioning_state == "Succeeded" + assert result.name == "default" + assert result.type == "Azure.ResourceManager.Models.Resources/singletonTrackedResources" + assert result.system_data.created_by == "AzureSDK" + + +@pytest.mark.asyncio +async def test_singleton_tracked_resources_list_by_resource_group(client): + response = client.singleton_tracked_resources.list_by_resource_group( + resource_group_name=RESOURCE_GROUP_NAME, + ) + result = [r async for r in response] + for result in result: + assert result.properties.description == "valid" + assert result.properties.provisioning_state == "Succeeded" + assert result.name == "default" + assert result.type == "Azure.ResourceManager.Models.Resources/singletonTrackedResources" + assert result.system_data.created_by == "AzureSDK" diff --git a/packages/typespec-python/test/azure/mock_api_tests/asynctests/test_azure_core_basic_async.py b/packages/typespec-python/test/azure/mock_api_tests/asynctests/test_azure_core_basic_async.py index 9a67c80137..87946f37ca 100644 --- a/packages/typespec-python/test/azure/mock_api_tests/asynctests/test_azure_core_basic_async.py +++ b/packages/typespec-python/test/azure/mock_api_tests/asynctests/test_azure_core_basic_async.py @@ -68,3 +68,9 @@ async def test_delete(client: aio.BasicClient): async def test_export(client: aio.BasicClient): result = await client.export(id=1, format="json") assert result == VALID_USER + + +@pytest.mark.asyncio +async def test_export_all_users(client: aio.BasicClient): + result = await client.export_all_users(format="json") + assert result.users[0] == VALID_USER diff --git a/packages/typespec-python/test/azure/mock_api_tests/test_azure_arm_models_resource.py b/packages/typespec-python/test/azure/mock_api_tests/test_azure_arm_models_resource.py index 427fbc38ed..7e0bc4cac5 100644 --- a/packages/typespec-python/test/azure/mock_api_tests/test_azure_arm_models_resource.py +++ b/packages/typespec-python/test/azure/mock_api_tests/test_azure_arm_models_resource.py @@ -186,3 +186,69 @@ def test_nested_proxy_resources_list_by_top_level_tracked_resource(client): assert result.name == "nested" assert result.type == "Azure.ResourceManager.Models.Resources/topLevelTrackedResources/top/nestedProxyResources" assert result.system_data.created_by == "AzureSDK" + + +def test_top_level_tracked_resources_action_sync(client): + client.top_level_tracked_resources.action_sync( + resource_group_name=RESOURCE_GROUP_NAME, + top_level_tracked_resource_name="top", + body={"message": "Resource action at top level.", "urgent": True}, + ) + + +def test_singleton_tracked_resources_get_by_resource_group(client): + result = client.singleton_tracked_resources.get_by_resource_group( + resource_group_name=RESOURCE_GROUP_NAME, + ) + assert result.properties.description == "valid" + assert result.properties.provisioning_state == "Succeeded" + assert result.name == "default" + assert result.type == "Azure.ResourceManager.Models.Resources/singletonTrackedResources" + assert result.system_data.created_by == "AzureSDK" + + +def test_singleton_tracked_resources_begin_create_or_replace(client): + result = client.singleton_tracked_resources.begin_create_or_update( + resource_group_name=RESOURCE_GROUP_NAME, + resource=models.SingletonTrackedResource( + location="eastus", + properties=models.SingletonTrackedResourceProperties( + models.SingletonTrackedResourceProperties(description="valid") + ), + ), + ).result() + assert result.properties.description == "valid" + assert result.properties.provisioning_state == "Succeeded" + assert result.name == "default" + assert result.type == "Azure.ResourceManager.Models.Resources/singletonTrackedResources" + assert result.system_data.created_by == "AzureSDK" + + +def test_singleton_tracked_resources_update(client): + result = client.singleton_tracked_resources.update( + resource_group_name=RESOURCE_GROUP_NAME, + properties=models.SingletonTrackedResource( + location="eastus2", + properties=models.SingletonTrackedResourceProperties( + models.SingletonTrackedResourceProperties(description="valid2") + ), + ), + ) + assert result.properties.description == "valid2" + assert result.properties.provisioning_state == "Succeeded" + assert result.name == "default" + assert result.type == "Azure.ResourceManager.Models.Resources/singletonTrackedResources" + assert result.system_data.created_by == "AzureSDK" + + +def test_singleton_tracked_resources_list_by_resource_group(client): + response = client.singleton_tracked_resources.list_by_resource_group( + resource_group_name=RESOURCE_GROUP_NAME, + ) + result = [r for r in response] + for result in result: + assert result.properties.description == "valid" + assert result.properties.provisioning_state == "Succeeded" + assert result.name == "default" + assert result.type == "Azure.ResourceManager.Models.Resources/singletonTrackedResources" + assert result.system_data.created_by == "AzureSDK" diff --git a/packages/typespec-python/test/azure/mock_api_tests/test_azure_core_basic.py b/packages/typespec-python/test/azure/mock_api_tests/test_azure_core_basic.py index 91a35bd86a..8ba50795a8 100644 --- a/packages/typespec-python/test/azure/mock_api_tests/test_azure_core_basic.py +++ b/packages/typespec-python/test/azure/mock_api_tests/test_azure_core_basic.py @@ -63,3 +63,8 @@ def test_delete(client: BasicClient): def test_export(client: BasicClient): result = client.export(id=1, format="json") assert result == VALID_USER + + +def test_export_all_users(client: BasicClient): + result = client.export_all_users(format="json") + assert result.users[0] == VALID_USER diff --git a/packages/typespec-python/test/azure/requirements.txt b/packages/typespec-python/test/azure/requirements.txt index 56e9791bf2..93ecc0b766 100644 --- a/packages/typespec-python/test/azure/requirements.txt +++ b/packages/typespec-python/test/azure/requirements.txt @@ -81,3 +81,4 @@ azure-mgmt-core==1.3.2 -e ./generated/versioning-renamedfrom -e ./generated/versioning-returntypechangedfrom -e ./generated/versioning-typechangedfrom +-e ./generated/routes diff --git a/packages/typespec-python/test/generic_mock_api_tests/asynctests/test_encode_numeric_async.py b/packages/typespec-python/test/generic_mock_api_tests/asynctests/test_encode_numeric_async.py index 64fcd4dfba..7bd8b5e1f5 100644 --- a/packages/typespec-python/test/generic_mock_api_tests/asynctests/test_encode_numeric_async.py +++ b/packages/typespec-python/test/generic_mock_api_tests/asynctests/test_encode_numeric_async.py @@ -26,3 +26,10 @@ async def test_uint32_as_string_optional(client: NumericClient): result = await client.property.uint32_as_string_optional(models.Uint32AsStringProperty(value=1)) assert result.value == 1 assert result["value"] == "1" + + +@pytest.mark.asyncio +async def test_uint8_as_string_optional(client: NumericClient): + result = await client.property.uint8_as_string(models.Uint32AsStringProperty(value=255)) + assert result.value == 255 + assert result["value"] == "255" diff --git a/packages/typespec-python/test/generic_mock_api_tests/asynctests/test_routes_async.py b/packages/typespec-python/test/generic_mock_api_tests/asynctests/test_routes_async.py new file mode 100644 index 0000000000..277e57be3a --- /dev/null +++ b/packages/typespec-python/test/generic_mock_api_tests/asynctests/test_routes_async.py @@ -0,0 +1,331 @@ +# ------------------------------------------------------------------------- +# 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 routes.aio import RoutesClient + + +@pytest.fixture +async def client(): + async with RoutesClient() as client: + yield client + + +@pytest.mark.asyncio +async def test_fixed(client: RoutesClient): + await client.fixed() + + +@pytest.mark.asyncio +async def test_in_interface_fixed(client: RoutesClient): + await client.in_interface.fixed() + + +@pytest.mark.asyncio +async def test_path_parameters_template_only(client: RoutesClient): + await client.path_parameters.template_only( + param="a", + ) + + +@pytest.mark.asyncio +async def test_path_parameters_explicit(client: RoutesClient): + await client.path_parameters.explicit( + param="a", + ) + + +@pytest.mark.asyncio +async def test_path_parameters_annotation_only(client: RoutesClient): + await client.path_parameters.annotation_only( + param="a", + ) + + +@pytest.mark.asyncio +async def test_path_parameters_reserved_expansion_template(client: RoutesClient): + await client.path_parameters.reserved_expansion.template( + param="foo/bar baz", + ) + + +@pytest.mark.asyncio +async def test_path_parameters_reserved_expansion_annotation(client: RoutesClient): + await client.path_parameters.reserved_expansion.annotation( + param="foo/bar baz", + ) + + +# @pytest.mark.asyncio +# async def test_path_parameters_simple_expansion_standard_primitive(client: RoutesClient): +# await client.path_parameters.simple_expansion.standard.primitive( +# param="a", +# ) + + +# @pytest.mark.asyncio +# async def test_path_parameters_simple_expansion_standard_array(client: RoutesClient): +# await client.path_parameters.simple_expansion.standard.array( +# param=["a", "b"], +# ) + + +# @pytest.mark.asyncio +# async def test_path_parameters_simple_expansion_standard_record(client: RoutesClient): +# await client.path_parameters.simple_expansion.standard.record( +# param={"a": 1, "b": 2}, +# ) + + +# @pytest.mark.asyncio +# async def test_path_parameters_simple_expansion_explode_primitive(client: RoutesClient): +# await client.path_parameters.simple_expansion.explode.primitive( +# param="a", +# ) + + +# @pytest.mark.asyncio +# async def test_path_parameters_simple_expansion_explode_array(client: RoutesClient): +# await client.path_parameters.simple_expansion.explode.array( +# param=["a", "b"], +# ) + + +# @pytest.mark.asyncio +# async def test_path_parameters_simple_expansion_explode_record(client: RoutesClient): +# await client.path_parameters.simple_expansion.explode.record( +# param={"a": 1, "b": 2}, +# ) + + +# @pytest.mark.asyncio +# async def test_path_parameters_path_expansion_standard_primitive(client: RoutesClient): +# await client.path_parameters.path_expansion.standard.primitive( +# param="a", +# ) + + +# @pytest.mark.asyncio +# async def test_path_parameters_path_expansion_standard_array(client: RoutesClient): +# await client.path_parameters.path_expansion.standard.array( +# param=["a", "b"], +# ) + + +# @pytest.mark.asyncio +# async def test_path_parameters_path_expansion_standard_record(client: RoutesClient): +# await client.path_parameters.path_expansion.standard.record( +# param={"a": 1, "b": 2}, +# ) + + +# @pytest.mark.asyncio +# async def test_path_parameters_path_expansion_explode_primitive(client: RoutesClient): +# await client.path_parameters.path_expansion.explode.primitive( +# param="a", +# ) + + +# @pytest.mark.asyncio +# async def test_path_parameters_path_expansion_explode_array(client: RoutesClient): +# await client.path_parameters.path_expansion.explode.array( +# param=["a", "b"], +# ) + + +# @pytest.mark.asyncio +# async def test_path_parameters_path_expansion_explode_record(client: RoutesClient): +# await client.path_parameters.path_expansion.explode.record( +# param={"a": 1, "b": 2}, +# ) + + +# @pytest.mark.asyncio +# async def test_path_parameters_label_expansion_standard_primitive(client: RoutesClient): +# await client.path_parameters.label_expansion.standard.primitive( +# param="a", +# ) + + +# @pytest.mark.asyncio +# async def test_path_parameters_label_expansion_standard_array(client: RoutesClient): +# await client.path_parameters.label_expansion.standard.array( +# param=["a", "b"], +# ) + + +# @pytest.mark.asyncio +# async def test_path_parameters_label_expansion_standard_record(client: RoutesClient): +# await client.path_parameters.label_expansion.standard.record( +# param={"a": 1, "b": 2}, +# ) + + +# @pytest.mark.asyncio +# async def test_path_parameters_label_expansion_explode_primitive(client: RoutesClient): +# await client.path_parameters.label_expansion.explode.primitive( +# param="a", +# ) + + +# @pytest.mark.asyncio +# async def test_path_parameters_label_expansion_explode_array(client: RoutesClient): +# await client.path_parameters.label_expansion.explode.array( +# param=["a", "b"], +# ) + + +# @pytest.mark.asyncio +# async def test_path_parameters_label_expansion_explode_record(client: RoutesClient): +# await client.path_parameters.label_expansion.explode.record( +# param={"a": 1, "b": 2}, +# ) + + +# @pytest.mark.asyncio +# async def test_path_parameters_matrix_expansion_standard_primitive(client: RoutesClient): +# await client.path_parameters.matrix_expansion.standard.primitive( +# param="a", +# ) + + +# @pytest.mark.asyncio +# async def test_path_parameters_matrix_expansion_standard_array(client: RoutesClient): +# await client.path_parameters.matrix_expansion.standard.array( +# param=["a", "b"], +# ) + + +# @pytest.mark.asyncio +# async def test_path_parameters_matrix_expansion_standard_record(client: RoutesClient): +# await client.path_parameters.matrix_expansion.standard.record( +# param={"a": 1, "b": 2}, +# ) + + +# @pytest.mark.asyncio +# async def test_path_parameters_matrix_expansion_explode_primitive(client: RoutesClient): +# await client.path_parameters.matrix_expansion.explode.primitive( +# param="a", +# ) + + +# @pytest.mark.asyncio +# async def test_path_parameters_matrix_expansion_explode_array(client: RoutesClient): +# await client.path_parameters.matrix_expansion.explode.array( +# param=["a", "b"], +# ) + + +# @pytest.mark.asyncio +# async def test_path_parameters_matrix_expansion_explode_record(client: RoutesClient): +# await client.path_parameters.matrix_expansion.explode.record( +# param={"a": 1, "b": 2}, +# ) + + +@pytest.mark.asyncio +async def test_query_parameters_template_only(client: RoutesClient): + await client.query_parameters.template_only( + param="a", + ) + + +@pytest.mark.asyncio +async def test_query_parameters_explicit(client: RoutesClient): + await client.query_parameters.explicit( + param="a", + ) + + +@pytest.mark.asyncio +async def test_query_parameters_annotation_only(client: RoutesClient): + await client.query_parameters.annotation_only( + param="a", + ) + + +@pytest.mark.asyncio +async def test_query_parameters_query_expansion_standard_primitive(client: RoutesClient): + await client.query_parameters.query_expansion.standard.primitive( + param="a", + ) + + +# @pytest.mark.asyncio +# async def test_query_parameters_query_expansion_standard_array(client: RoutesClient): +# await client.query_parameters.query_expansion.standard.array( +# param=["a", "b"], +# ) + + +# @pytest.mark.asyncio +# async def test_query_parameters_query_expansion_standard_record(client: RoutesClient): +# await client.query_parameters.query_expansion.standard.record( +# param={"a": 1, "b": 2}, +# ) + + +@pytest.mark.asyncio +async def test_query_parameters_query_expansion_explode_primitive(client: RoutesClient): + await client.query_parameters.query_expansion.explode.primitive( + param="a", + ) + + +# @pytest.mark.asyncio +# async def test_query_parameters_query_expansion_explode_array(client: RoutesClient): +# await client.query_parameters.query_expansion.explode.array( +# param=["a", "b"], +# ) + + +# @pytest.mark.asyncio +# async def test_query_parameters_query_expansion_explode_record(client: RoutesClient): +# await client.query_parameters.query_expansion.explode.record( +# param={"a": 1, "b": 2}, +# ) + + +@pytest.mark.asyncio +async def test_query_parameters_query_continuation_standard_primitive(client: RoutesClient): + await client.query_parameters.query_continuation.standard.primitive( + param="a", + ) + + +# @pytest.mark.asyncio +# async def test_query_parameters_query_continuation_standard_array(client: RoutesClient): +# await client.query_parameters.query_continuation.standard.array( +# param=["a", "b"], +# ) + + +# @pytest.mark.asyncio +# async def test_query_parameters_query_continuation_standard_record(client: RoutesClient): +# await client.query_parameters.query_continuation.standard.record( +# param={"a": 1, "b": 2}, +# ) + + +@pytest.mark.asyncio +async def test_query_parameters_query_continuation_explode_primitive(client: RoutesClient): + await client.query_parameters.query_continuation.explode.primitive( + param="a", + ) + + +# @pytest.mark.asyncio +# async def test_query_parameters_query_continuation_explode_array(client: RoutesClient): +# await client.query_parameters.query_continuation.explode.array( +# param=["a", "b"], +# ) + + +# @pytest.mark.asyncio +# async def test_query_parameters_query_continuation_explode_record(client: RoutesClient): +# await client.query_parameters.query_continuation.explode.record( +# param={"a": 1, "b": 2}, +# ) diff --git a/packages/typespec-python/test/generic_mock_api_tests/test_encode_numeric.py b/packages/typespec-python/test/generic_mock_api_tests/test_encode_numeric.py index 397b1e69f6..b0dff4af5c 100644 --- a/packages/typespec-python/test/generic_mock_api_tests/test_encode_numeric.py +++ b/packages/typespec-python/test/generic_mock_api_tests/test_encode_numeric.py @@ -23,3 +23,9 @@ def test_uint32_as_string_optional(client: NumericClient): result = client.property.uint32_as_string_optional(models.Uint32AsStringProperty(value=1)) assert result.value == 1 assert result["value"] == "1" + + +def test_uint8_as_string_optional(client: NumericClient): + result = client.property.uint8_as_string(models.Uint32AsStringProperty(value=255)) + assert result.value == 255 + assert result["value"] == "255" diff --git a/packages/typespec-python/test/generic_mock_api_tests/test_routes.py b/packages/typespec-python/test/generic_mock_api_tests/test_routes.py new file mode 100644 index 0000000000..e1058d0665 --- /dev/null +++ b/packages/typespec-python/test/generic_mock_api_tests/test_routes.py @@ -0,0 +1,285 @@ +# ------------------------------------------------------------------------- +# 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 routes import RoutesClient + + +@pytest.fixture +def client(): + with RoutesClient() as client: + yield client + + +def test_fixed(client: RoutesClient): + client.fixed() + + +def test_in_interface_fixed(client: RoutesClient): + client.in_interface.fixed() + + +def test_path_parameters_template_only(client: RoutesClient): + client.path_parameters.template_only( + param="a", + ) + + +def test_path_parameters_explicit(client: RoutesClient): + client.path_parameters.explicit( + param="a", + ) + + +def test_path_parameters_annotation_only(client: RoutesClient): + client.path_parameters.annotation_only( + param="a", + ) + + +def test_path_parameters_reserved_expansion_template(client: RoutesClient): + client.path_parameters.reserved_expansion.template( + param="foo/bar baz", + ) + + +def test_path_parameters_reserved_expansion_annotation(client: RoutesClient): + client.path_parameters.reserved_expansion.annotation( + param="foo/bar baz", + ) + + +# def test_path_parameters_simple_expansion_standard_primitive(client: RoutesClient): +# client.path_parameters.simple_expansion.standard.primitive( +# param="a", +# ) + + +# def test_path_parameters_simple_expansion_standard_array(client: RoutesClient): +# client.path_parameters.simple_expansion.standard.array( +# param=["a", "b"], +# ) + + +# def test_path_parameters_simple_expansion_standard_record(client: RoutesClient): +# client.path_parameters.simple_expansion.standard.record( +# param={"a": 1, "b": 2}, +# ) + + +# def test_path_parameters_simple_expansion_explode_primitive(client: RoutesClient): +# client.path_parameters.simple_expansion.explode.primitive( +# param="a", +# ) + + +# def test_path_parameters_simple_expansion_explode_array(client: RoutesClient): +# client.path_parameters.simple_expansion.explode.array( +# param=["a", "b"], +# ) + + +# def test_path_parameters_simple_expansion_explode_record(client: RoutesClient): +# client.path_parameters.simple_expansion.explode.record( +# param={"a": 1, "b": 2}, +# ) + + +# def test_path_parameters_path_expansion_standard_primitive(client: RoutesClient): +# client.path_parameters.path_expansion.standard.primitive( +# param="a", +# ) + + +# def test_path_parameters_path_expansion_standard_array(client: RoutesClient): +# client.path_parameters.path_expansion.standard.array( +# param=["a", "b"], +# ) + + +# def test_path_parameters_path_expansion_standard_record(client: RoutesClient): +# client.path_parameters.path_expansion.standard.record( +# param={"a": 1, "b": 2}, +# ) + + +# def test_path_parameters_path_expansion_explode_primitive(client: RoutesClient): +# client.path_parameters.path_expansion.explode.primitive( +# param="a", +# ) + + +# def test_path_parameters_path_expansion_explode_array(client: RoutesClient): +# client.path_parameters.path_expansion.explode.array( +# param=["a", "b"], +# ) + + +# def test_path_parameters_path_expansion_explode_record(client: RoutesClient): +# client.path_parameters.path_expansion.explode.record( +# param={"a": 1, "b": 2}, +# ) + + +# def test_path_parameters_label_expansion_standard_primitive(client: RoutesClient): +# client.path_parameters.label_expansion.standard.primitive( +# param="a", +# ) + + +# def test_path_parameters_label_expansion_standard_array(client: RoutesClient): +# client.path_parameters.label_expansion.standard.array( +# param=["a", "b"], +# ) + + +# def test_path_parameters_label_expansion_standard_record(client: RoutesClient): +# client.path_parameters.label_expansion.standard.record( +# param={"a": 1, "b": 2}, +# ) + + +# def test_path_parameters_label_expansion_explode_primitive(client: RoutesClient): +# client.path_parameters.label_expansion.explode.primitive( +# param="a", +# ) + + +# def test_path_parameters_label_expansion_explode_array(client: RoutesClient): +# client.path_parameters.label_expansion.explode.array( +# param=["a", "b"], +# ) + + +# def test_path_parameters_label_expansion_explode_record(client: RoutesClient): +# client.path_parameters.label_expansion.explode.record( +# param={"a": 1, "b": 2}, +# ) + + +# def test_path_parameters_matrix_expansion_standard_primitive(client: RoutesClient): +# client.path_parameters.matrix_expansion.standard.primitive( +# param="a", +# ) + + +# def test_path_parameters_matrix_expansion_standard_array(client: RoutesClient): +# client.path_parameters.matrix_expansion.standard.array( +# param=["a", "b"], +# ) + + +# def test_path_parameters_matrix_expansion_standard_record(client: RoutesClient): +# client.path_parameters.matrix_expansion.standard.record( +# param={"a": 1, "b": 2}, +# ) + + +# def test_path_parameters_matrix_expansion_explode_primitive(client: RoutesClient): +# client.path_parameters.matrix_expansion.explode.primitive( +# param="a", +# ) + + +# def test_path_parameters_matrix_expansion_explode_array(client: RoutesClient): +# client.path_parameters.matrix_expansion.explode.array( +# param=["a", "b"], +# ) + + +# def test_path_parameters_matrix_expansion_explode_record(client: RoutesClient): +# client.path_parameters.matrix_expansion.explode.record( +# param={"a": 1, "b": 2}, +# ) + + +def test_query_parameters_template_only(client: RoutesClient): + client.query_parameters.template_only( + param="a", + ) + + +def test_query_parameters_explicit(client: RoutesClient): + client.query_parameters.explicit( + param="a", + ) + + +def test_query_parameters_annotation_only(client: RoutesClient): + client.query_parameters.annotation_only( + param="a", + ) + + +def test_query_parameters_query_expansion_standard_primitive(client: RoutesClient): + client.query_parameters.query_expansion.standard.primitive( + param="a", + ) + + +# def test_query_parameters_query_expansion_standard_array(client: RoutesClient): +# client.query_parameters.query_expansion.standard.array( +# param=["a", "b"], +# ) + + +# def test_query_parameters_query_expansion_standard_record(client: RoutesClient): +# client.query_parameters.query_expansion.standard.record( +# param={"a": 1, "b": 2}, +# ) + + +def test_query_parameters_query_expansion_explode_primitive(client: RoutesClient): + client.query_parameters.query_expansion.explode.primitive( + param="a", + ) + + +# def test_query_parameters_query_expansion_explode_array(client: RoutesClient): +# client.query_parameters.query_expansion.explode.array( +# param=["a", "b"], +# ) + + +# def test_query_parameters_query_expansion_explode_record(client: RoutesClient): +# client.query_parameters.query_expansion.explode.record( +# param={"a": 1, "b": 2}, +# ) + + +def test_query_parameters_query_continuation_standard_primitive(client: RoutesClient): + client.query_parameters.query_continuation.standard.primitive( + param="a", + ) + + +# def test_query_parameters_query_continuation_standard_array(client: RoutesClient): +# client.query_parameters.query_continuation.standard.array( +# param=["a", "b"], +# ) + + +# def test_query_parameters_query_continuation_standard_record(client: RoutesClient): +# client.query_parameters.query_continuation.standard.record( +# param={"a": 1, "b": 2}, +# ) + + +def test_query_parameters_query_continuation_explode_primitive(client: RoutesClient): + client.query_parameters.query_continuation.explode.primitive( + param="a", + ) + + +# def test_query_parameters_query_continuation_explode_array(client: RoutesClient): +# client.query_parameters.query_continuation.explode.array( +# param=["a", "b"], +# ) + + +# def test_query_parameters_query_continuation_explode_record(client: RoutesClient): +# client.query_parameters.query_continuation.explode.record( +# param={"a": 1, "b": 2}, +# ) diff --git a/packages/typespec-python/test/unbranded/requirements.txt b/packages/typespec-python/test/unbranded/requirements.txt index 94b01ef520..cff50c6097 100644 --- a/packages/typespec-python/test/unbranded/requirements.txt +++ b/packages/typespec-python/test/unbranded/requirements.txt @@ -65,3 +65,4 @@ corehttp==1.0.0b3 -e ./generated/versioning-renamedfrom -e ./generated/versioning-returntypechangedfrom -e ./generated/versioning-typechangedfrom +-e ./generated/routes