@typespec/http-client-python 0.27.2 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/emitter/emitter.js +1 -1
  2. package/dist/emitter/emitter.js.map +1 -1
  3. package/dist/emitter/http.d.ts.map +1 -1
  4. package/dist/emitter/http.js +2 -13
  5. package/dist/emitter/http.js.map +1 -1
  6. package/emitter/src/emitter.ts +1 -1
  7. package/emitter/src/http.ts +1 -13
  8. package/emitter/temp/tsconfig.tsbuildinfo +1 -1
  9. package/eng/scripts/setup/__pycache__/package_manager.cpython-311.pyc +0 -0
  10. package/eng/scripts/setup/__pycache__/venvtools.cpython-311.pyc +0 -0
  11. package/generator/build/lib/pygen/codegen/templates/model_base.py.jinja2 +6 -2
  12. package/generator/build/lib/pygen/preprocess/__init__.py +9 -21
  13. package/generator/build/lib/pygen/preprocess/python_mappings.py +0 -2
  14. package/generator/component-detection-pip-report.json +5 -6
  15. package/generator/dist/pygen-0.1.0-py3-none-any.whl +0 -0
  16. package/generator/pygen/codegen/templates/model_base.py.jinja2 +6 -2
  17. package/generator/pygen/preprocess/__init__.py +9 -21
  18. package/generator/pygen/preprocess/python_mappings.py +0 -2
  19. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_flatten_async.py +24 -2
  20. package/generator/test/azure/mock_api_tests/asynctests/test_special_words_async.py +6 -0
  21. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_flatten.py +22 -2
  22. package/generator/test/azure/mock_api_tests/test_special_words.py +5 -0
  23. package/generator/test/generic_mock_api_tests/asynctests/test_authentication_async.py +13 -1
  24. package/generator/test/generic_mock_api_tests/test_authentication.py +11 -1
  25. package/generator/test/unbranded/mock_api_tests/asynctests/test_special_words_async.py +7 -0
  26. package/generator/test/unbranded/mock_api_tests/test_special_words.py +6 -0
  27. package/generator/test/unittests/test_enums.py +37 -0
  28. package/generator/test/unittests/test_model_base_xml_serialization.py +244 -2
  29. package/generator/test/unittests/test_name_converter.py +0 -8
  30. package/package.json +33 -33
@@ -652,6 +652,9 @@ class Model(_MyMutableMapping):
652
652
  if len(items) > 0:
653
653
  existed_attr_keys.append(xml_name)
654
654
  dict_to_pass[rf._rest_name] = _deserialize(rf._type, items)
655
+ elif not rf._is_optional:
656
+ existed_attr_keys.append(xml_name)
657
+ dict_to_pass[rf._rest_name] = []
655
658
  continue
656
659
 
657
660
  # text element is primitive type
@@ -930,6 +933,8 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-retur
930
933
  # is it optional?
931
934
  try:
932
935
  if any(a is _NONE_TYPE for a in annotation.__args__): # pyright: ignore
936
+ if rf:
937
+ rf._is_optional = True
933
938
  if len(annotation.__args__) <= 2: # pyright: ignore
934
939
  if_obj_deserializer = _get_deserialize_callable_from_annotation(
935
940
  next(a for a in annotation.__args__ if a is not _NONE_TYPE), module, rf # pyright: ignore
@@ -1090,9 +1095,7 @@ def _failsafe_deserialize_xml(
1090
1095
  return None
1091
1096
 
1092
1097
 
1093
- {% if code_model.has_padded_model_property %}
1094
1098
  # pylint: disable=too-many-instance-attributes
1095
- {% endif %}
1096
1099
  class _RestField:
1097
1100
  def __init__(
1098
1101
  self,
@@ -1115,6 +1118,7 @@ class _RestField:
1115
1118
  self._is_discriminator = is_discriminator
1116
1119
  self._visibility = visibility
1117
1120
  self._is_model = False
1121
+ self._is_optional = False
1118
1122
  self._default = default
1119
1123
  self._format = format
1120
1124
  self._is_multipart_file_input = is_multipart_file_input
@@ -4,6 +4,7 @@
4
4
  # license information.
5
5
  # --------------------------------------------------------------------------
6
6
  """The preprocessing autorest plugin."""
7
+
7
8
  import copy
8
9
  from typing import Callable, Any, Optional
9
10
 
@@ -21,7 +22,6 @@ from ..utils import (
21
22
  get_body_type_for_description,
22
23
  JSON_REGEXP,
23
24
  KNOWN_TYPES,
24
- update_enum_value,
25
25
  )
26
26
 
27
27
 
@@ -267,30 +267,18 @@ class PreProcessPlugin(YamlUpdatePlugin):
267
267
  add_redefined_builtin_info(property["clientName"], property)
268
268
  if type.get("name"):
269
269
  pad_type = PadType.MODEL if type["type"] == "model" else PadType.ENUM_CLASS
270
- name = self.pad_reserved_words(type["name"], pad_type, type)
271
- type["name"] = name[0].upper() + name[1:]
270
+ if type["type"] != "enumvalue":
271
+ name = self.pad_reserved_words(type["name"], pad_type, type)
272
+ type["name"] = name[0].upper() + name[1:]
272
273
  type["description"] = update_description(type.get("description", ""), type["name"])
273
274
  type["snakeCaseName"] = to_snake_case(type["name"])
274
275
  if type.get("values"):
275
- # we're enums
276
- values_to_add = []
276
+ # we're enums - enum values are UPPER_CASE so no padding needed for reserved words
277
277
  for value in type["values"]:
278
- padded_name = self.pad_reserved_words(value["name"].lower(), PadType.ENUM_VALUE, value).upper()
279
- if self.version_tolerant:
280
- if padded_name[0] in "0123456789":
281
- padded_name = "ENUM_" + padded_name
282
- value["name"] = padded_name
283
- else:
284
- if value["name"] != padded_name:
285
- values_to_add.append(
286
- update_enum_value(
287
- name=padded_name,
288
- value=value["value"],
289
- description=value["description"],
290
- enum_type=value["enumType"],
291
- )
292
- )
293
- type["values"].extend(values_to_add)
278
+ upper_name = value["name"].upper()
279
+ if upper_name[0] in "0123456789":
280
+ upper_name = "ENUM_" + upper_name
281
+ value["name"] = upper_name
294
282
 
295
283
  # add type for reference
296
284
  for v in HEADERS_CONVERT_IN_METHOD.values():
@@ -56,7 +56,6 @@ class PadType(str, Enum):
56
56
  ENUM_CLASS = "Enum"
57
57
  METHOD = "_method"
58
58
  PARAMETER = "_parameter"
59
- ENUM_VALUE = "_enum"
60
59
  PROPERTY = "_property"
61
60
  OPERATION_GROUP = "Operations"
62
61
 
@@ -183,7 +182,6 @@ RESERVED_WORDS = {
183
182
  PadType.MODEL: ["enum", *_always_reserved],
184
183
  PadType.PROPERTY: ["self", *_always_reserved],
185
184
  PadType.ENUM_CLASS: ["enum", *_always_reserved],
186
- PadType.ENUM_VALUE: ["mro", *_always_reserved],
187
185
  PadType.OPERATION_GROUP: [*_always_reserved],
188
186
  }
189
187
 
@@ -4,11 +4,11 @@
4
4
  "install": [
5
5
  {
6
6
  "download_info": {
7
- "url": "https://files.pythonhosted.org/packages/e1/c6/76dc613121b793286a3f91621d7b75a2b493e0390ddca50f11993eadf192/setuptools-82.0.0-py3-none-any.whl",
7
+ "url": "https://files.pythonhosted.org/packages/9d/76/f789f7a86709c6b087c5a2f52f911838cad707cc613162401badc665acfe/setuptools-82.0.1-py3-none-any.whl",
8
8
  "archive_info": {
9
- "hash": "sha256=70b18734b607bd1da571d097d236cfcfacaf01de45717d59e6e04b96877532e0",
9
+ "hash": "sha256=a59e362652f08dcd477c78bb6e7bd9d80a7995bc73ce773050228a348ce2e5bb",
10
10
  "hashes": {
11
- "sha256": "70b18734b607bd1da571d097d236cfcfacaf01de45717d59e6e04b96877532e0"
11
+ "sha256": "a59e362652f08dcd477c78bb6e7bd9d80a7995bc73ce773050228a348ce2e5bb"
12
12
  }
13
13
  }
14
14
  },
@@ -18,11 +18,11 @@
18
18
  "metadata": {
19
19
  "metadata_version": "2.4",
20
20
  "name": "setuptools",
21
- "version": "82.0.0",
21
+ "version": "82.0.1",
22
22
  "dynamic": [
23
23
  "license-file"
24
24
  ],
25
- "summary": "Easily download, build, install, upgrade, and uninstall Python packages",
25
+ "summary": "Most extensible Python build backend with support for C/C++ extension modules",
26
26
  "description": ".. |pypi-version| image:: https://img.shields.io/pypi/v/setuptools.svg\n :target: https://pypi.org/project/setuptools\n\n.. |py-version| image:: https://img.shields.io/pypi/pyversions/setuptools.svg\n\n.. |test-badge| image:: https://github.com/pypa/setuptools/actions/workflows/main.yml/badge.svg\n :target: https://github.com/pypa/setuptools/actions?query=workflow%3A%22tests%22\n :alt: tests\n\n.. |ruff-badge| image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json\n :target: https://github.com/astral-sh/ruff\n :alt: Ruff\n\n.. |docs-badge| image:: https://img.shields.io/readthedocs/setuptools/latest.svg\n :target: https://setuptools.pypa.io\n\n.. |skeleton-badge| image:: https://img.shields.io/badge/skeleton-2025-informational\n :target: https://blog.jaraco.com/skeleton\n\n.. |codecov-badge| image:: https://img.shields.io/codecov/c/github/pypa/setuptools/master.svg?logo=codecov&logoColor=white\n :target: https://codecov.io/gh/pypa/setuptools\n\n.. |tidelift-badge| image:: https://tidelift.com/badges/github/pypa/setuptools?style=flat\n :target: https://tidelift.com/subscription/pkg/pypi-setuptools?utm_source=pypi-setuptools&utm_medium=readme\n\n.. |discord-badge| image:: https://img.shields.io/discord/803025117553754132\n :target: https://discord.com/channels/803025117553754132/815945031150993468\n :alt: Discord\n\n|pypi-version| |py-version| |test-badge| |ruff-badge| |docs-badge| |skeleton-badge| |codecov-badge| |discord-badge|\n\nSee the `Quickstart <https://setuptools.pypa.io/en/latest/userguide/quickstart.html>`_\nand the `User's Guide <https://setuptools.pypa.io/en/latest/userguide/>`_ for\ninstructions on how to use Setuptools.\n\nQuestions and comments should be directed to `GitHub Discussions\n<https://github.com/pypa/setuptools/discussions>`_.\nBug reports and especially tested patches may be\nsubmitted directly to the `bug tracker\n<https://github.com/pypa/setuptools/issues>`_.\n\n\nCode of Conduct\n===============\n\nEveryone interacting in the setuptools project's codebases, issue trackers,\nchat rooms, and fora is expected to follow the\n`PSF Code of Conduct <https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md>`_.\n\n\nFor Enterprise\n==============\n\nAvailable as part of the Tidelift Subscription.\n\nSetuptools and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.\n\n`Learn more <https://tidelift.com/subscription/pkg/pypi-setuptools?utm_source=pypi-setuptools&utm_medium=referral&utm_campaign=github>`_.\n",
27
27
  "description_content_type": "text/x-rst",
28
28
  "keywords": [
@@ -88,7 +88,6 @@
88
88
  "importlib_metadata>=6; python_version < \"3.10\" and extra == \"core\"",
89
89
  "tomli>=2.0.1; python_version < \"3.11\" and extra == \"core\"",
90
90
  "wheel>=0.43.0; extra == \"core\"",
91
- "platformdirs>=4.2.2; extra == \"core\"",
92
91
  "jaraco.functools>=4; extra == \"core\"",
93
92
  "more_itertools; extra == \"core\"",
94
93
  "pytest-checkdocs>=2.4; extra == \"check\"",
@@ -652,6 +652,9 @@ class Model(_MyMutableMapping):
652
652
  if len(items) > 0:
653
653
  existed_attr_keys.append(xml_name)
654
654
  dict_to_pass[rf._rest_name] = _deserialize(rf._type, items)
655
+ elif not rf._is_optional:
656
+ existed_attr_keys.append(xml_name)
657
+ dict_to_pass[rf._rest_name] = []
655
658
  continue
656
659
 
657
660
  # text element is primitive type
@@ -930,6 +933,8 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-retur
930
933
  # is it optional?
931
934
  try:
932
935
  if any(a is _NONE_TYPE for a in annotation.__args__): # pyright: ignore
936
+ if rf:
937
+ rf._is_optional = True
933
938
  if len(annotation.__args__) <= 2: # pyright: ignore
934
939
  if_obj_deserializer = _get_deserialize_callable_from_annotation(
935
940
  next(a for a in annotation.__args__ if a is not _NONE_TYPE), module, rf # pyright: ignore
@@ -1090,9 +1095,7 @@ def _failsafe_deserialize_xml(
1090
1095
  return None
1091
1096
 
1092
1097
 
1093
- {% if code_model.has_padded_model_property %}
1094
1098
  # pylint: disable=too-many-instance-attributes
1095
- {% endif %}
1096
1099
  class _RestField:
1097
1100
  def __init__(
1098
1101
  self,
@@ -1115,6 +1118,7 @@ class _RestField:
1115
1118
  self._is_discriminator = is_discriminator
1116
1119
  self._visibility = visibility
1117
1120
  self._is_model = False
1121
+ self._is_optional = False
1118
1122
  self._default = default
1119
1123
  self._format = format
1120
1124
  self._is_multipart_file_input = is_multipart_file_input
@@ -4,6 +4,7 @@
4
4
  # license information.
5
5
  # --------------------------------------------------------------------------
6
6
  """The preprocessing autorest plugin."""
7
+
7
8
  import copy
8
9
  from typing import Callable, Any, Optional
9
10
 
@@ -21,7 +22,6 @@ from ..utils import (
21
22
  get_body_type_for_description,
22
23
  JSON_REGEXP,
23
24
  KNOWN_TYPES,
24
- update_enum_value,
25
25
  )
26
26
 
27
27
 
@@ -267,30 +267,18 @@ class PreProcessPlugin(YamlUpdatePlugin):
267
267
  add_redefined_builtin_info(property["clientName"], property)
268
268
  if type.get("name"):
269
269
  pad_type = PadType.MODEL if type["type"] == "model" else PadType.ENUM_CLASS
270
- name = self.pad_reserved_words(type["name"], pad_type, type)
271
- type["name"] = name[0].upper() + name[1:]
270
+ if type["type"] != "enumvalue":
271
+ name = self.pad_reserved_words(type["name"], pad_type, type)
272
+ type["name"] = name[0].upper() + name[1:]
272
273
  type["description"] = update_description(type.get("description", ""), type["name"])
273
274
  type["snakeCaseName"] = to_snake_case(type["name"])
274
275
  if type.get("values"):
275
- # we're enums
276
- values_to_add = []
276
+ # we're enums - enum values are UPPER_CASE so no padding needed for reserved words
277
277
  for value in type["values"]:
278
- padded_name = self.pad_reserved_words(value["name"].lower(), PadType.ENUM_VALUE, value).upper()
279
- if self.version_tolerant:
280
- if padded_name[0] in "0123456789":
281
- padded_name = "ENUM_" + padded_name
282
- value["name"] = padded_name
283
- else:
284
- if value["name"] != padded_name:
285
- values_to_add.append(
286
- update_enum_value(
287
- name=padded_name,
288
- value=value["value"],
289
- description=value["description"],
290
- enum_type=value["enumType"],
291
- )
292
- )
293
- type["values"].extend(values_to_add)
278
+ upper_name = value["name"].upper()
279
+ if upper_name[0] in "0123456789":
280
+ upper_name = "ENUM_" + upper_name
281
+ value["name"] = upper_name
294
282
 
295
283
  # add type for reference
296
284
  for v in HEADERS_CONVERT_IN_METHOD.values():
@@ -56,7 +56,6 @@ class PadType(str, Enum):
56
56
  ENUM_CLASS = "Enum"
57
57
  METHOD = "_method"
58
58
  PARAMETER = "_parameter"
59
- ENUM_VALUE = "_enum"
60
59
  PROPERTY = "_property"
61
60
  OPERATION_GROUP = "Operations"
62
61
 
@@ -183,7 +182,6 @@ RESERVED_WORDS = {
183
182
  PadType.MODEL: ["enum", *_always_reserved],
184
183
  PadType.PROPERTY: ["self", *_always_reserved],
185
184
  PadType.ENUM_CLASS: ["enum", *_always_reserved],
186
- PadType.ENUM_VALUE: ["mro", *_always_reserved],
187
185
  PadType.OPERATION_GROUP: [*_always_reserved],
188
186
  }
189
187
 
@@ -6,10 +6,13 @@
6
6
  import pytest
7
7
  from specs.azure.clientgenerator.core.flattenproperty.aio import FlattenPropertyClient
8
8
  from specs.azure.clientgenerator.core.flattenproperty.models import (
9
- FlattenModel,
9
+ ChildFlattenModel,
10
10
  ChildModel,
11
+ FlattenModel,
12
+ FlattenUnknownModel,
11
13
  NestedFlattenModel,
12
- ChildFlattenModel,
14
+ Solution,
15
+ SolutionProperties,
13
16
  )
14
17
 
15
18
 
@@ -46,6 +49,25 @@ async def test_put_nested_flatten_model(client: FlattenPropertyClient):
46
49
  )
47
50
 
48
51
 
52
+ @pytest.mark.asyncio
53
+ async def test_put_flatten_unknown_model(client: FlattenPropertyClient):
54
+ result = await client.put_flatten_unknown_model(FlattenUnknownModel(name="foo"))
55
+ assert result.name == "test"
56
+ assert result.properties == {"key1": "value1", "key2": "value2"}
57
+
58
+
59
+ @pytest.mark.asyncio
60
+ async def test_put_flatten_read_only_model(client: FlattenPropertyClient):
61
+ result = await client.put_flatten_read_only_model(Solution(name="foo"))
62
+ assert result == Solution(
63
+ name="foo",
64
+ properties=SolutionProperties(solution_id="solution1", title="Solution Title", content="Solution Content"),
65
+ )
66
+ assert result.solution_id == "solution1"
67
+ assert result.title == "Solution Title"
68
+ assert result.content == "Solution Content"
69
+
70
+
49
71
  @pytest.mark.asyncio # ============test for compatibility ============
50
72
  async def test_dpg_model_common():
51
73
  flatten_model = FlattenModel(name="hello", properties=ChildModel(age=0, description="test"))
@@ -63,3 +63,9 @@ async def test_model_properties_dict_methods(client: SpecialWordsClient):
63
63
  @pytest.mark.asyncio
64
64
  async def test_model_properties_with_list(client: SpecialWordsClient):
65
65
  await client.model_properties.with_list(models.ModelWithList(list="ok"))
66
+
67
+
68
+ @pytest.mark.asyncio
69
+ async def test_extensible_strings(client: SpecialWordsClient):
70
+ for enum_value in models.ExtensibleString:
71
+ assert enum_value == await client.extensible_strings.put_extensible_string_value(body=enum_value)
@@ -6,10 +6,13 @@
6
6
  import pytest
7
7
  from specs.azure.clientgenerator.core.flattenproperty import FlattenPropertyClient
8
8
  from specs.azure.clientgenerator.core.flattenproperty.models import (
9
- FlattenModel,
9
+ ChildFlattenModel,
10
10
  ChildModel,
11
+ FlattenModel,
12
+ FlattenUnknownModel,
11
13
  NestedFlattenModel,
12
- ChildFlattenModel,
14
+ Solution,
15
+ SolutionProperties,
13
16
  )
14
17
 
15
18
 
@@ -41,6 +44,23 @@ def test_put_nested_flatten_model(client: FlattenPropertyClient):
41
44
  )
42
45
 
43
46
 
47
+ def test_put_flatten_unknown_model(client: FlattenPropertyClient):
48
+ result = client.put_flatten_unknown_model(FlattenUnknownModel(name="foo"))
49
+ assert result.name == "test"
50
+ assert result.properties == {"key1": "value1", "key2": "value2"}
51
+
52
+
53
+ def test_put_flatten_read_only_model(client: FlattenPropertyClient):
54
+ result = client.put_flatten_read_only_model(Solution(name="foo"))
55
+ assert result == Solution(
56
+ name="foo",
57
+ properties=SolutionProperties(solution_id="solution1", title="Solution Title", content="Solution Content"),
58
+ )
59
+ assert result.solution_id == "solution1"
60
+ assert result.title == "Solution Title"
61
+ assert result.content == "Solution Content"
62
+
63
+
44
64
  # ============test for compatibility ============
45
65
  def test_dpg_model_common():
46
66
  flatten_model = FlattenModel(name="hello", properties=ChildModel(age=0, description="test"))
@@ -56,3 +56,8 @@ def test_model_properties_dict_methods(client: SpecialWordsClient):
56
56
 
57
57
  def test_model_properties_with_list(client: SpecialWordsClient):
58
58
  client.model_properties.with_list(models.ModelWithList(list="ok"))
59
+
60
+
61
+ def test_extensible_strings(client: SpecialWordsClient):
62
+ for enum_value in models.ExtensibleString:
63
+ assert enum_value == client.extensible_strings.put_extensible_string_value(body=enum_value)
@@ -9,7 +9,7 @@ from authentication.http.custom.aio import CustomClient
9
9
  from authentication.oauth2.aio import OAuth2Client
10
10
  from authentication.union.aio import UnionClient
11
11
  from setuppy.authentication.union.aio import UnionClient as SetuppyUnionClient
12
-
12
+ from authentication.noauth.union.aio import UnionClient as NoauthUnionClient
13
13
 
14
14
  # Utilities functions
15
15
 
@@ -113,6 +113,18 @@ async def test_union_tokenvalid(oauth2_client, union_client_type):
113
113
  await client.valid_token(enforce_https=False)
114
114
 
115
115
 
116
+ @pytest.mark.asyncio
117
+ async def test_noauth_union_valid_no_auth():
118
+ client = NoauthUnionClient()
119
+ await client.valid_no_auth()
120
+
121
+
122
+ @pytest.mark.asyncio
123
+ async def test_noauth_union_valid_token(oauth2_client):
124
+ client = oauth2_client(NoauthUnionClient)
125
+ await client.valid_token(enforce_https=False)
126
+
127
+
116
128
  @pytest.mark.asyncio
117
129
  async def test_http_custom_valid(http_custom_client):
118
130
  client = http_custom_client()
@@ -8,9 +8,9 @@ from authentication.apikey import ApiKeyClient
8
8
  from authentication.oauth2 import OAuth2Client
9
9
  from authentication.union import UnionClient
10
10
  from setuppy.authentication.union import UnionClient as SetuppyUnionClient
11
+ from authentication.noauth.union import UnionClient as NoauthUnionClient
11
12
  from authentication.http.custom import CustomClient
12
13
 
13
-
14
14
  # Utilities functions
15
15
 
16
16
 
@@ -107,6 +107,16 @@ def test_union_tokenvalid(oauth2_client, union_client_type):
107
107
  client.valid_token(enforce_https=False)
108
108
 
109
109
 
110
+ def test_noauth_union_valid_no_auth():
111
+ client = NoauthUnionClient()
112
+ client.valid_no_auth()
113
+
114
+
115
+ def test_noauth_union_valid_token(oauth2_client):
116
+ client = oauth2_client(NoauthUnionClient)
117
+ client.valid_token(enforce_https=False)
118
+
119
+
110
120
  def test_http_custom_valid(http_custom_client):
111
121
  client = http_custom_client()
112
122
  client.valid()
@@ -7,6 +7,7 @@ import pytest
7
7
  from specialwords.aio import SpecialWordsClient
8
8
  from specialwords.models import models
9
9
  from specialwords.modelproperties import models as model_properties_models
10
+ from specialwords.extensiblestrings import models as extensible_strings_models
10
11
 
11
12
 
12
13
  @pytest.fixture
@@ -64,3 +65,9 @@ async def test_model_properties_dict_methods(client: SpecialWordsClient):
64
65
  @pytest.mark.asyncio
65
66
  async def test_model_properties_with_list(client: SpecialWordsClient):
66
67
  await client.model_properties.with_list(model_properties_models.ModelWithList(list="ok"))
68
+
69
+
70
+ @pytest.mark.asyncio
71
+ async def test_extensible_strings(client: SpecialWordsClient):
72
+ for enum_value in extensible_strings_models.ExtensibleString:
73
+ assert enum_value == await client.extensible_strings.put_extensible_string_value(body=enum_value)
@@ -7,6 +7,7 @@ import pytest
7
7
  from specialwords import SpecialWordsClient
8
8
  from specialwords.models import models
9
9
  from specialwords.modelproperties import models as model_properties_models
10
+ from specialwords.extensiblestrings import models as extensible_strings_models
10
11
 
11
12
 
12
13
  @pytest.fixture
@@ -58,3 +59,8 @@ def test_model_properties_dict_methods(client: SpecialWordsClient):
58
59
 
59
60
  def test_model_properties_with_list(client: SpecialWordsClient):
60
61
  client.model_properties.with_list(model_properties_models.ModelWithList(list="ok"))
62
+
63
+
64
+ def test_extensible_strings(client: SpecialWordsClient):
65
+ for enum_value in extensible_strings_models.ExtensibleString:
66
+ assert enum_value == client.extensible_strings.put_extensible_string_value(body=enum_value)
@@ -4,6 +4,7 @@
4
4
  # license information.
5
5
  # --------------------------------------------------------------------------
6
6
  from enum import Enum, EnumMeta
7
+ from specialwords.extensiblestrings import models as extensible_strings_models
7
8
 
8
9
 
9
10
  class _CaseInsensitiveEnumMeta(EnumMeta):
@@ -50,3 +51,39 @@ def test_find():
50
51
  def test_join():
51
52
  assert EnumsWithCallableNames.JOIN == "join"
52
53
  assert callable(EnumsWithCallableNames.join)
54
+
55
+
56
+ def test_extensible_strings_enum_with_special_words():
57
+ assert extensible_strings_models.ExtensibleString.AND == "and"
58
+ assert extensible_strings_models.ExtensibleString.AS == "as"
59
+ assert extensible_strings_models.ExtensibleString.ASSERT == "assert"
60
+ assert extensible_strings_models.ExtensibleString.ASYNC == "async"
61
+ assert extensible_strings_models.ExtensibleString.AWAIT == "await"
62
+ assert extensible_strings_models.ExtensibleString.BREAK == "break"
63
+ assert extensible_strings_models.ExtensibleString.CLASS == "class"
64
+ assert extensible_strings_models.ExtensibleString.CONSTRUCTOR == "constructor"
65
+ assert extensible_strings_models.ExtensibleString.CONTINUE == "continue"
66
+ assert extensible_strings_models.ExtensibleString.DEF == "def"
67
+ assert extensible_strings_models.ExtensibleString.DEL == "del"
68
+ assert extensible_strings_models.ExtensibleString.ELIF == "elif"
69
+ assert extensible_strings_models.ExtensibleString.ELSE == "else"
70
+ assert extensible_strings_models.ExtensibleString.EXCEPT == "except"
71
+ assert extensible_strings_models.ExtensibleString.EXEC == "exec"
72
+ assert extensible_strings_models.ExtensibleString.FINALLY == "finally"
73
+ assert extensible_strings_models.ExtensibleString.FOR == "for"
74
+ assert extensible_strings_models.ExtensibleString.FROM == "from"
75
+ assert extensible_strings_models.ExtensibleString.GLOBAL == "global"
76
+ assert extensible_strings_models.ExtensibleString.IF == "if"
77
+ assert extensible_strings_models.ExtensibleString.IMPORT == "import"
78
+ assert extensible_strings_models.ExtensibleString.IN == "in"
79
+ assert extensible_strings_models.ExtensibleString.IS == "is"
80
+ assert extensible_strings_models.ExtensibleString.LAMBDA == "lambda"
81
+ assert extensible_strings_models.ExtensibleString.NOT == "not"
82
+ assert extensible_strings_models.ExtensibleString.OR == "or"
83
+ assert extensible_strings_models.ExtensibleString.PASS == "pass"
84
+ assert extensible_strings_models.ExtensibleString.RAISE == "raise"
85
+ assert extensible_strings_models.ExtensibleString.RETURN == "return"
86
+ assert extensible_strings_models.ExtensibleString.TRY == "try"
87
+ assert extensible_strings_models.ExtensibleString.WHILE == "while"
88
+ assert extensible_strings_models.ExtensibleString.WITH == "with"
89
+ assert extensible_strings_models.ExtensibleString.YIELD == "yield"