Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: internal
packages:
- "@typespec/http-client-python"
---

Add mock API test coverage for extensible enum with special word member names in special-words spec.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# license information.
# --------------------------------------------------------------------------
"""The preprocessing autorest plugin."""

import copy
from typing import Callable, Any, Optional

Expand Down Expand Up @@ -264,7 +265,7 @@ def update_types(self, yaml_data: list[dict[str, Any]]) -> None:
property["clientName"].lower(), PadType.PROPERTY, property
)
add_redefined_builtin_info(property["clientName"], property)
if type.get("name"):
if type.get("name") and type["type"] != "enumvalue":
Comment thread
msyyc marked this conversation as resolved.
pad_type = PadType.MODEL if type["type"] == "model" else PadType.ENUM_CLASS
name = self.pad_reserved_words(type["name"], pad_type, type)
type["name"] = name[0].upper() + name[1:]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,9 @@ async def test_model_properties_dict_methods(client: SpecialWordsClient):
@pytest.mark.asyncio
async def test_model_properties_with_list(client: SpecialWordsClient):
await client.model_properties.with_list(models.ModelWithList(list="ok"))


@pytest.mark.asyncio
async def test_extensible_strings(client: SpecialWordsClient):
result = await client.extensible_strings.put_extensible_string_value(body=models.ExtensibleString.CLASS)
assert result == '"class"'
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,8 @@ def test_model_properties_dict_methods(client: SpecialWordsClient):

def test_model_properties_with_list(client: SpecialWordsClient):
client.model_properties.with_list(models.ModelWithList(list="ok"))


def test_extensible_strings(client: SpecialWordsClient):
result = client.extensible_strings.put_extensible_string_value(body=models.ExtensibleString.CLASS)
assert result == '"class"'
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,9 @@ async def test_model_properties_dict_methods(client: SpecialWordsClient):
@pytest.mark.asyncio
async def test_model_properties_with_list(client: SpecialWordsClient):
await client.model_properties.with_list(model_properties_models.ModelWithList(list="ok"))


@pytest.mark.asyncio
async def test_extensible_strings(client: SpecialWordsClient):
result = await client.extensible_strings.put_extensible_string_value(body="class")
assert result == '"class"'
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,8 @@ def test_model_properties_dict_methods(client: SpecialWordsClient):

def test_model_properties_with_list(client: SpecialWordsClient):
client.model_properties.with_list(model_properties_models.ModelWithList(list="ok"))


def test_extensible_strings(client: SpecialWordsClient):
result = client.extensible_strings.put_extensible_string_value(body="class")
assert result == '"class"'
28 changes: 14 additions & 14 deletions packages/http-client-python/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/http-client-python/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"@typespec/sse": "~0.79.0",
"@typespec/streams": "~0.79.0",
"@typespec/xml": "~0.79.0",
"@typespec/http-specs": "0.1.0-alpha.33-dev.2",
"@typespec/http-specs": "0.1.0-alpha.33-dev.5",
"@types/js-yaml": "~4.0.5",
"@types/node": "~25.0.2",
"@types/semver": "7.5.8",
Expand Down