diff --git a/.chronus/changes/python-reserved-operation-body-params-test-2026-4-28-23-10-0.md b/.chronus/changes/python-reserved-operation-body-params-test-2026-4-28-23-10-0.md new file mode 100644 index 00000000000..ad10ee1042b --- /dev/null +++ b/.chronus/changes/python-reserved-operation-body-params-test-2026-4-28-23-10-0.md @@ -0,0 +1,7 @@ +--- +changeKind: internal +packages: + - "@typespec/http-client-python" +--- + +Add mock API test cases for operation body parameters with reserved names (e.g., `items`) to verify the wire name is not mangled. diff --git a/packages/http-client-python/tests/mock_api/azure/asynctests/test_special_words_async.py b/packages/http-client-python/tests/mock_api/azure/asynctests/test_special_words_async.py index 8c59ea05070..78650db138d 100644 --- a/packages/http-client-python/tests/mock_api/azure/asynctests/test_special_words_async.py +++ b/packages/http-client-python/tests/mock_api/azure/asynctests/test_special_words_async.py @@ -70,3 +70,8 @@ async def test_model_properties_with_list(client: SpecialWordsClient): async def test_extensible_strings(client: SpecialWordsClient): for enum_value in models.ExtensibleString: assert enum_value == await client.extensible_strings.put_extensible_string_value(body=enum_value) + + +@pytest.mark.asyncio +async def test_reserved_operation_body_params_with_items(client: SpecialWordsClient): + await client.reserved_operation_body_params.with_items(items=["item"]) diff --git a/packages/http-client-python/tests/mock_api/azure/test_special_words.py b/packages/http-client-python/tests/mock_api/azure/test_special_words.py index ab23b59409f..234301dede1 100644 --- a/packages/http-client-python/tests/mock_api/azure/test_special_words.py +++ b/packages/http-client-python/tests/mock_api/azure/test_special_words.py @@ -61,3 +61,7 @@ def test_model_properties_with_list(client: SpecialWordsClient): def test_extensible_strings(client: SpecialWordsClient): for enum_value in models.ExtensibleString: assert enum_value == client.extensible_strings.put_extensible_string_value(body=enum_value) + + +def test_reserved_operation_body_params_with_items(client: SpecialWordsClient): + client.reserved_operation_body_params.with_items(items=["item"]) diff --git a/packages/http-client-python/tests/mock_api/unbranded/asynctests/test_special_words_async.py b/packages/http-client-python/tests/mock_api/unbranded/asynctests/test_special_words_async.py index c1e3bc0a8f2..5b8dcebaf1f 100644 --- a/packages/http-client-python/tests/mock_api/unbranded/asynctests/test_special_words_async.py +++ b/packages/http-client-python/tests/mock_api/unbranded/asynctests/test_special_words_async.py @@ -72,3 +72,8 @@ async def test_model_properties_with_list(client: SpecialWordsClient): async def test_extensible_strings(client: SpecialWordsClient): for enum_value in extensible_strings_models.ExtensibleString: assert enum_value == await client.extensible_strings.put_extensible_string_value(body=enum_value) + + +@pytest.mark.asyncio +async def test_reserved_operation_body_params_with_items(client: SpecialWordsClient): + await client.reserved_operation_body_params.with_items(items=["item"]) diff --git a/packages/http-client-python/tests/mock_api/unbranded/test_special_words.py b/packages/http-client-python/tests/mock_api/unbranded/test_special_words.py index 83269cc1e47..9da0330a805 100644 --- a/packages/http-client-python/tests/mock_api/unbranded/test_special_words.py +++ b/packages/http-client-python/tests/mock_api/unbranded/test_special_words.py @@ -64,3 +64,7 @@ def test_model_properties_with_list(client: SpecialWordsClient): def test_extensible_strings(client: SpecialWordsClient): for enum_value in extensible_strings_models.ExtensibleString: assert enum_value == client.extensible_strings.put_extensible_string_value(body=enum_value) + + +def test_reserved_operation_body_params_with_items(client: SpecialWordsClient): + client.reserved_operation_body_params.with_items(items=["item"])