@typespec/http-client-python 0.24.0 → 0.25.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/code-model.d.ts.map +1 -1
  2. package/dist/emitter/code-model.js +10 -1
  3. package/dist/emitter/code-model.js.map +1 -1
  4. package/emitter/src/code-model.ts +9 -1
  5. package/emitter/temp/tsconfig.tsbuildinfo +1 -1
  6. package/eng/scripts/setup/__pycache__/package_manager.cpython-311.pyc +0 -0
  7. package/eng/scripts/setup/__pycache__/venvtools.cpython-311.pyc +0 -0
  8. package/generator/build/lib/pygen/codegen/templates/model_base.py.jinja2 +20 -10
  9. package/generator/component-detection-pip-report.json +5 -4
  10. package/generator/dist/pygen-0.1.0-py3-none-any.whl +0 -0
  11. package/generator/pygen/codegen/templates/model_base.py.jinja2 +20 -10
  12. package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_operationtemplates_async.py +17 -0
  13. package/generator/test/azure/mock_api_tests/asynctests/test_payload_multipart_async.py +33 -0
  14. package/generator/test/azure/mock_api_tests/asynctests/test_special_words_async.py +5 -0
  15. package/generator/test/azure/mock_api_tests/test_azure_arm_operationtemplates.py +13 -14
  16. package/generator/test/azure/mock_api_tests/test_payload_multipart.py +31 -0
  17. package/generator/test/azure/mock_api_tests/test_special_words.py +4 -0
  18. package/generator/test/azure/requirements.txt +1 -0
  19. package/generator/test/generic_mock_api_tests/asynctests/test_encode_array_async.py +96 -0
  20. package/generator/test/generic_mock_api_tests/asynctests/test_specs_documentation_async.py +1 -2
  21. package/generator/test/generic_mock_api_tests/test_encode_array.py +88 -0
  22. package/generator/test/generic_mock_api_tests/test_specs_documentation.py +0 -1
  23. package/generator/test/unbranded/mock_api_tests/asynctests/test_payload_multipart_async.py +33 -0
  24. package/generator/test/unbranded/mock_api_tests/asynctests/test_special_words_async.py +23 -0
  25. package/generator/test/unbranded/mock_api_tests/test_payload_multipart.py +31 -0
  26. package/generator/test/unbranded/mock_api_tests/test_special_words.py +21 -0
  27. package/generator/test/unbranded/mock_api_tests/test_unbranded.py +8 -3
  28. package/generator/test/unbranded/requirements.txt +1 -0
  29. package/generator/test/unittests/test_model_base_serialization.py +53 -0
  30. package/package.json +33 -33
@@ -848,6 +848,14 @@ def _deserialize_multiple_sequence(
848
848
  return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers))
849
849
 
850
850
 
851
+ def _is_array_encoded_deserializer(deserializer: functools.partial) -> bool:
852
+ return (
853
+ isinstance(deserializer, functools.partial)
854
+ and isinstance(deserializer.args[0], functools.partial)
855
+ and deserializer.args[0].func == _deserialize_array_encoded # pylint: disable=comparison-with-callable
856
+ )
857
+
858
+
851
859
  def _deserialize_sequence(
852
860
  deserializer: typing.Optional[typing.Callable],
853
861
  module: typing.Optional[str],
@@ -857,17 +865,19 @@ def _deserialize_sequence(
857
865
  return obj
858
866
  if isinstance(obj, ET.Element):
859
867
  obj = list(obj)
860
- try:
861
- if (
862
- isinstance(obj, str)
863
- and isinstance(deserializer, functools.partial)
864
- and isinstance(deserializer.args[0], functools.partial)
865
- and deserializer.args[0].func == _deserialize_array_encoded # pylint: disable=comparison-with-callable
866
- ):
867
- # encoded string may be deserialized to sequence
868
+
869
+ # encoded string may be deserialized to sequence
870
+ if isinstance(obj, str) and isinstance(deserializer, functools.partial):
871
+ # for list[str]
872
+ if _is_array_encoded_deserializer(deserializer):
868
873
  return deserializer(obj)
869
- except: # pylint: disable=bare-except
870
- pass
874
+
875
+ # for list[Union[...]]
876
+ if isinstance(deserializer.args[0], list):
877
+ for sub_deserializer in deserializer.args[0]:
878
+ if _is_array_encoded_deserializer(sub_deserializer):
879
+ return sub_deserializer(obj)
880
+
871
881
  return type(obj)(_deserialize(deserializer, entry, module) for entry in obj)
872
882
 
873
883
 
@@ -4,11 +4,11 @@
4
4
  "install": [
5
5
  {
6
6
  "download_info": {
7
- "url": "https://files.pythonhosted.org/packages/a3/dc/17031897dae0efacfea57dfd3a82fdd2a2aeb58e0ff71b77b87e44edc772/setuptools-80.9.0-py3-none-any.whl",
7
+ "url": "https://files.pythonhosted.org/packages/e0/76/f963c61683a39084aa575f98089253e1e852a4417cb8a3a8a422923a5246/setuptools-80.10.1-py3-none-any.whl",
8
8
  "archive_info": {
9
- "hash": "sha256=062d34222ad13e0cc312a4c02d73f059e86a4acbfbdea8f8f76b28c99f306922",
9
+ "hash": "sha256=fc30c51cbcb8199a219c12cc9c281b5925a4978d212f84229c909636d9f6984e",
10
10
  "hashes": {
11
- "sha256": "062d34222ad13e0cc312a4c02d73f059e86a4acbfbdea8f8f76b28c99f306922"
11
+ "sha256": "fc30c51cbcb8199a219c12cc9c281b5925a4978d212f84229c909636d9f6984e"
12
12
  }
13
13
  }
14
14
  },
@@ -18,7 +18,7 @@
18
18
  "metadata": {
19
19
  "metadata_version": "2.4",
20
20
  "name": "setuptools",
21
- "version": "80.9.0",
21
+ "version": "80.10.1",
22
22
  "dynamic": [
23
23
  "license-file"
24
24
  ],
@@ -63,6 +63,7 @@
63
63
  "tomli-w>=1.0.0; extra == \"test\"",
64
64
  "pytest-timeout; extra == \"test\"",
65
65
  "pytest-perf; sys_platform != \"cygwin\" and extra == \"test\"",
66
+ "pyobjc<12; (sys_platform == \"darwin\" and python_version <= \"3.9\") and extra == \"test\"",
66
67
  "jaraco.develop>=7.21; (python_version >= \"3.9\" and sys_platform != \"cygwin\") and extra == \"test\"",
67
68
  "pytest-home>=0.5; extra == \"test\"",
68
69
  "pytest-subprocess; extra == \"test\"",
@@ -848,6 +848,14 @@ def _deserialize_multiple_sequence(
848
848
  return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers))
849
849
 
850
850
 
851
+ def _is_array_encoded_deserializer(deserializer: functools.partial) -> bool:
852
+ return (
853
+ isinstance(deserializer, functools.partial)
854
+ and isinstance(deserializer.args[0], functools.partial)
855
+ and deserializer.args[0].func == _deserialize_array_encoded # pylint: disable=comparison-with-callable
856
+ )
857
+
858
+
851
859
  def _deserialize_sequence(
852
860
  deserializer: typing.Optional[typing.Callable],
853
861
  module: typing.Optional[str],
@@ -857,17 +865,19 @@ def _deserialize_sequence(
857
865
  return obj
858
866
  if isinstance(obj, ET.Element):
859
867
  obj = list(obj)
860
- try:
861
- if (
862
- isinstance(obj, str)
863
- and isinstance(deserializer, functools.partial)
864
- and isinstance(deserializer.args[0], functools.partial)
865
- and deserializer.args[0].func == _deserialize_array_encoded # pylint: disable=comparison-with-callable
866
- ):
867
- # encoded string may be deserialized to sequence
868
+
869
+ # encoded string may be deserialized to sequence
870
+ if isinstance(obj, str) and isinstance(deserializer, functools.partial):
871
+ # for list[str]
872
+ if _is_array_encoded_deserializer(deserializer):
868
873
  return deserializer(obj)
869
- except: # pylint: disable=bare-except
870
- pass
874
+
875
+ # for list[Union[...]]
876
+ if isinstance(deserializer.args[0], list):
877
+ for sub_deserializer in deserializer.args[0]:
878
+ if _is_array_encoded_deserializer(sub_deserializer):
879
+ return sub_deserializer(obj)
880
+
871
881
  return type(obj)(_deserialize(deserializer, entry, module) for entry in obj)
872
882
 
873
883
 
@@ -174,3 +174,20 @@ async def test_optional_body_provider_post_with_body(client):
174
174
  )
175
175
  assert result.total_allowed == 100
176
176
  assert result.status == "Changed to requested allowance"
177
+
178
+
179
+ @pytest.mark.asyncio
180
+ async def test_lro_paging_begin_post_paging_lro(client):
181
+ poller = await client.lro_paging.begin_post_paging_lro(
182
+ resource_group_name=RESOURCE_GROUP_NAME,
183
+ product_name="default",
184
+ )
185
+ result = await poller.result()
186
+ items = [item async for item in result]
187
+ assert len(items) == 2
188
+ assert items[0].name == "product1"
189
+ assert items[0].properties.product_id == "product1"
190
+ assert items[0].properties.provisioning_state == "Succeeded"
191
+ assert items[1].name == "product2"
192
+ assert items[1].properties.product_id == "product2"
193
+ assert items[1].properties.provisioning_state == "Succeeded"
@@ -151,3 +151,36 @@ async def test_complex_with_http_part(client: MultiPartClient):
151
151
  @pytest.mark.asyncio
152
152
  async def test_http_parts_non_string_float(client: MultiPartClient):
153
153
  await client.form_data.http_parts.non_string.float(models.FloatRequest(temperature=0.5))
154
+
155
+
156
+ @pytest.mark.asyncio
157
+ async def test_with_wire_name(client: MultiPartClient):
158
+ await client.form_data.with_wire_name(
159
+ models.MultiPartRequestWithWireName(
160
+ identifier="123",
161
+ image=open(str(JPG), "rb"),
162
+ )
163
+ )
164
+
165
+
166
+ @pytest.mark.asyncio
167
+ async def test_optional_parts(client: MultiPartClient):
168
+ # First time with only id
169
+ await client.form_data.optional_parts(
170
+ models.MultiPartOptionalRequest(
171
+ id="123",
172
+ )
173
+ )
174
+ # Second time with only profileImage
175
+ await client.form_data.optional_parts(
176
+ models.MultiPartOptionalRequest(
177
+ profile_image=open(str(JPG), "rb"),
178
+ )
179
+ )
180
+ # Third time with both id and profileImage
181
+ await client.form_data.optional_parts(
182
+ models.MultiPartOptionalRequest(
183
+ id="123",
184
+ profile_image=open(str(JPG), "rb"),
185
+ )
186
+ )
@@ -58,3 +58,8 @@ async def test_model_properties_dict_methods(client: SpecialWordsClient):
58
58
  copy_property="ok",
59
59
  )
60
60
  )
61
+
62
+
63
+ @pytest.mark.asyncio
64
+ async def test_model_properties_with_list(client: SpecialWordsClient):
65
+ await client.model_properties.with_list(models.ModelWithList(list="ok"))
@@ -156,17 +156,16 @@ def test_optional_body_provider_post_with_body(client):
156
156
  assert result.status == "Changed to requested allowance"
157
157
 
158
158
 
159
- # enable the test case after https://github.com/Azure/typespec-azure/pull/3695 merged and released
160
- # def test_lro_paging_begin_post_paging_lro(client):
161
- # result = client.lro_paging.begin_post_paging_lro(
162
- # resource_group_name=RESOURCE_GROUP_NAME,
163
- # product_name="default",
164
- # ).result()
165
- # items = list(result)
166
- # assert len(items) == 2
167
- # assert items[0].name == "product1"
168
- # assert items[0].properties.product_id == "product1"
169
- # assert items[0].properties.provisioning_state == "Succeeded"
170
- # assert items[1].name == "product2"
171
- # assert items[1].properties.product_id == "product2"
172
- # assert items[1].properties.provisioning_state == "Succeeded"
159
+ def test_lro_paging_begin_post_paging_lro(client):
160
+ result = client.lro_paging.begin_post_paging_lro(
161
+ resource_group_name=RESOURCE_GROUP_NAME,
162
+ product_name="default",
163
+ ).result()
164
+ items = list(result)
165
+ assert len(items) == 2
166
+ assert items[0].name == "product1"
167
+ assert items[0].properties.product_id == "product1"
168
+ assert items[0].properties.provisioning_state == "Succeeded"
169
+ assert items[1].name == "product2"
170
+ assert items[1].properties.product_id == "product2"
171
+ assert items[1].properties.provisioning_state == "Succeeded"
@@ -138,3 +138,34 @@ def test_complex_with_http_part(client: MultiPartClient):
138
138
 
139
139
  def test_http_parts_non_string_float(client: MultiPartClient):
140
140
  client.form_data.http_parts.non_string.float(models.FloatRequest(temperature=0.5))
141
+
142
+
143
+ def test_with_wire_name(client: MultiPartClient):
144
+ client.form_data.with_wire_name(
145
+ models.MultiPartRequestWithWireName(
146
+ identifier="123",
147
+ image=open(str(JPG), "rb"),
148
+ )
149
+ )
150
+
151
+
152
+ def test_optional_parts(client: MultiPartClient):
153
+ # First time with only id
154
+ client.form_data.optional_parts(
155
+ models.MultiPartOptionalRequest(
156
+ id="123",
157
+ )
158
+ )
159
+ # Second time with only profileImage
160
+ client.form_data.optional_parts(
161
+ models.MultiPartOptionalRequest(
162
+ profile_image=open(str(JPG), "rb"),
163
+ )
164
+ )
165
+ # Third time with both id and profileImage
166
+ client.form_data.optional_parts(
167
+ models.MultiPartOptionalRequest(
168
+ id="123",
169
+ profile_image=open(str(JPG), "rb"),
170
+ )
171
+ )
@@ -52,3 +52,7 @@ def test_model_properties_dict_methods(client: SpecialWordsClient):
52
52
  copy_property="ok",
53
53
  )
54
54
  )
55
+
56
+
57
+ def test_model_properties_with_list(client: SpecialWordsClient):
58
+ client.model_properties.with_list(models.ModelWithList(list="ok"))
@@ -55,6 +55,7 @@ azure-mgmt-core==1.6.0
55
55
  # common test case
56
56
  -e ./generated/authentication-api-key
57
57
  -e ./generated/authentication-http-custom
58
+ -e ./generated/authentication-noauth-union
58
59
  -e ./generated/authentication-oauth2
59
60
  -e ./generated/authentication-union
60
61
  -e ./generated/setuppy-authentication-union
@@ -41,3 +41,99 @@ async def test_newline_delimited(client: ArrayClient):
41
41
  body = models.NewlineDelimitedArrayProperty(value=["blue", "red", "green"])
42
42
  result = await client.property.newline_delimited(body)
43
43
  assert result.value == ["blue", "red", "green"]
44
+
45
+
46
+ @pytest.mark.asyncio
47
+ async def test_enum_comma_delimited(client: ArrayClient):
48
+ body = models.CommaDelimitedEnumArrayProperty(value=[models.Colors.BLUE, models.Colors.RED, models.Colors.GREEN])
49
+ result = await client.property.enum_comma_delimited(body)
50
+ assert result.value == [models.Colors.BLUE, models.Colors.RED, models.Colors.GREEN]
51
+
52
+
53
+ @pytest.mark.asyncio
54
+ async def test_enum_space_delimited(client: ArrayClient):
55
+ body = models.SpaceDelimitedEnumArrayProperty(value=[models.Colors.BLUE, models.Colors.RED, models.Colors.GREEN])
56
+ result = await client.property.enum_space_delimited(body)
57
+ assert result.value == [models.Colors.BLUE, models.Colors.RED, models.Colors.GREEN]
58
+
59
+
60
+ @pytest.mark.asyncio
61
+ async def test_enum_pipe_delimited(client: ArrayClient):
62
+ body = models.PipeDelimitedEnumArrayProperty(value=[models.Colors.BLUE, models.Colors.RED, models.Colors.GREEN])
63
+ result = await client.property.enum_pipe_delimited(body)
64
+ assert result.value == [models.Colors.BLUE, models.Colors.RED, models.Colors.GREEN]
65
+
66
+
67
+ @pytest.mark.asyncio
68
+ async def test_enum_newline_delimited(client: ArrayClient):
69
+ body = models.NewlineDelimitedEnumArrayProperty(value=[models.Colors.BLUE, models.Colors.RED, models.Colors.GREEN])
70
+ result = await client.property.enum_newline_delimited(body)
71
+ assert result.value == [models.Colors.BLUE, models.Colors.RED, models.Colors.GREEN]
72
+
73
+
74
+ @pytest.mark.asyncio
75
+ async def test_extensible_enum_comma_delimited(client: ArrayClient):
76
+ body = models.CommaDelimitedExtensibleEnumArrayProperty(
77
+ value=[
78
+ models.ColorsExtensibleEnum.BLUE,
79
+ models.ColorsExtensibleEnum.RED,
80
+ models.ColorsExtensibleEnum.GREEN,
81
+ ]
82
+ )
83
+ result = await client.property.extensible_enum_comma_delimited(body)
84
+ assert result.value == [
85
+ models.ColorsExtensibleEnum.BLUE,
86
+ models.ColorsExtensibleEnum.RED,
87
+ models.ColorsExtensibleEnum.GREEN,
88
+ ]
89
+
90
+
91
+ @pytest.mark.asyncio
92
+ async def test_extensible_enum_space_delimited(client: ArrayClient):
93
+ body = models.SpaceDelimitedExtensibleEnumArrayProperty(
94
+ value=[
95
+ models.ColorsExtensibleEnum.BLUE,
96
+ models.ColorsExtensibleEnum.RED,
97
+ models.ColorsExtensibleEnum.GREEN,
98
+ ]
99
+ )
100
+ result = await client.property.extensible_enum_space_delimited(body)
101
+ assert result.value == [
102
+ models.ColorsExtensibleEnum.BLUE,
103
+ models.ColorsExtensibleEnum.RED,
104
+ models.ColorsExtensibleEnum.GREEN,
105
+ ]
106
+
107
+
108
+ @pytest.mark.asyncio
109
+ async def test_extensible_enum_pipe_delimited(client: ArrayClient):
110
+ body = models.PipeDelimitedExtensibleEnumArrayProperty(
111
+ value=[
112
+ models.ColorsExtensibleEnum.BLUE,
113
+ models.ColorsExtensibleEnum.RED,
114
+ models.ColorsExtensibleEnum.GREEN,
115
+ ]
116
+ )
117
+ result = await client.property.extensible_enum_pipe_delimited(body)
118
+ assert result.value == [
119
+ models.ColorsExtensibleEnum.BLUE,
120
+ models.ColorsExtensibleEnum.RED,
121
+ models.ColorsExtensibleEnum.GREEN,
122
+ ]
123
+
124
+
125
+ @pytest.mark.asyncio
126
+ async def test_extensible_enum_newline_delimited(client: ArrayClient):
127
+ body = models.NewlineDelimitedExtensibleEnumArrayProperty(
128
+ value=[
129
+ models.ColorsExtensibleEnum.BLUE,
130
+ models.ColorsExtensibleEnum.RED,
131
+ models.ColorsExtensibleEnum.GREEN,
132
+ ]
133
+ )
134
+ result = await client.property.extensible_enum_newline_delimited(body)
135
+ assert result.value == [
136
+ models.ColorsExtensibleEnum.BLUE,
137
+ models.ColorsExtensibleEnum.RED,
138
+ models.ColorsExtensibleEnum.GREEN,
139
+ ]
@@ -22,11 +22,10 @@ class TestLists:
22
22
  # Expected: 204 No Content
23
23
  await client.lists.bullet_points_op()
24
24
 
25
- @pytest.mark.skip(reason="https://github.com/microsoft/typespec/issues/9173")
26
25
  @pytest.mark.asyncio
27
26
  async def test_bullet_points_model(self, client: DocumentationClient):
28
27
  # POST /documentation/lists/bullet-points/model
29
- # Expected request body: {"prop": "Simple"}
28
+ # Expected request body: {"input": {"prop": "Simple"}}
30
29
  # Expected: 200 OK
31
30
  await client.lists.bullet_points_model(input=models.BulletPointsModel(prop="Simple"))
32
31
 
@@ -36,3 +36,91 @@ def test_newline_delimited(client: ArrayClient):
36
36
  body = models.NewlineDelimitedArrayProperty(value=["blue", "red", "green"])
37
37
  result = client.property.newline_delimited(body)
38
38
  assert result.value == ["blue", "red", "green"]
39
+
40
+
41
+ def test_enum_comma_delimited(client: ArrayClient):
42
+ body = models.CommaDelimitedEnumArrayProperty(value=[models.Colors.BLUE, models.Colors.RED, models.Colors.GREEN])
43
+ result = client.property.enum_comma_delimited(body)
44
+ assert result.value == [models.Colors.BLUE, models.Colors.RED, models.Colors.GREEN]
45
+
46
+
47
+ def test_enum_space_delimited(client: ArrayClient):
48
+ body = models.SpaceDelimitedEnumArrayProperty(value=[models.Colors.BLUE, models.Colors.RED, models.Colors.GREEN])
49
+ result = client.property.enum_space_delimited(body)
50
+ assert result.value == [models.Colors.BLUE, models.Colors.RED, models.Colors.GREEN]
51
+
52
+
53
+ def test_enum_pipe_delimited(client: ArrayClient):
54
+ body = models.PipeDelimitedEnumArrayProperty(value=[models.Colors.BLUE, models.Colors.RED, models.Colors.GREEN])
55
+ result = client.property.enum_pipe_delimited(body)
56
+ assert result.value == [models.Colors.BLUE, models.Colors.RED, models.Colors.GREEN]
57
+
58
+
59
+ def test_enum_newline_delimited(client: ArrayClient):
60
+ body = models.NewlineDelimitedEnumArrayProperty(value=[models.Colors.BLUE, models.Colors.RED, models.Colors.GREEN])
61
+ result = client.property.enum_newline_delimited(body)
62
+ assert result.value == [models.Colors.BLUE, models.Colors.RED, models.Colors.GREEN]
63
+
64
+
65
+ def test_extensible_enum_comma_delimited(client: ArrayClient):
66
+ body = models.CommaDelimitedExtensibleEnumArrayProperty(
67
+ value=[
68
+ models.ColorsExtensibleEnum.BLUE,
69
+ models.ColorsExtensibleEnum.RED,
70
+ models.ColorsExtensibleEnum.GREEN,
71
+ ]
72
+ )
73
+ result = client.property.extensible_enum_comma_delimited(body)
74
+ assert result.value == [
75
+ models.ColorsExtensibleEnum.BLUE,
76
+ models.ColorsExtensibleEnum.RED,
77
+ models.ColorsExtensibleEnum.GREEN,
78
+ ]
79
+
80
+
81
+ def test_extensible_enum_space_delimited(client: ArrayClient):
82
+ body = models.SpaceDelimitedExtensibleEnumArrayProperty(
83
+ value=[
84
+ models.ColorsExtensibleEnum.BLUE,
85
+ models.ColorsExtensibleEnum.RED,
86
+ models.ColorsExtensibleEnum.GREEN,
87
+ ]
88
+ )
89
+ result = client.property.extensible_enum_space_delimited(body)
90
+ assert result.value == [
91
+ models.ColorsExtensibleEnum.BLUE,
92
+ models.ColorsExtensibleEnum.RED,
93
+ models.ColorsExtensibleEnum.GREEN,
94
+ ]
95
+
96
+
97
+ def test_extensible_enum_pipe_delimited(client: ArrayClient):
98
+ body = models.PipeDelimitedExtensibleEnumArrayProperty(
99
+ value=[
100
+ models.ColorsExtensibleEnum.BLUE,
101
+ models.ColorsExtensibleEnum.RED,
102
+ models.ColorsExtensibleEnum.GREEN,
103
+ ]
104
+ )
105
+ result = client.property.extensible_enum_pipe_delimited(body)
106
+ assert result.value == [
107
+ models.ColorsExtensibleEnum.BLUE,
108
+ models.ColorsExtensibleEnum.RED,
109
+ models.ColorsExtensibleEnum.GREEN,
110
+ ]
111
+
112
+
113
+ def test_extensible_enum_newline_delimited(client: ArrayClient):
114
+ body = models.NewlineDelimitedExtensibleEnumArrayProperty(
115
+ value=[
116
+ models.ColorsExtensibleEnum.BLUE,
117
+ models.ColorsExtensibleEnum.RED,
118
+ models.ColorsExtensibleEnum.GREEN,
119
+ ]
120
+ )
121
+ result = client.property.extensible_enum_newline_delimited(body)
122
+ assert result.value == [
123
+ models.ColorsExtensibleEnum.BLUE,
124
+ models.ColorsExtensibleEnum.RED,
125
+ models.ColorsExtensibleEnum.GREEN,
126
+ ]
@@ -20,7 +20,6 @@ class TestLists:
20
20
  # Expected: 204 No Content
21
21
  client.lists.bullet_points_op()
22
22
 
23
- @pytest.mark.skip(reason="https://github.com/microsoft/typespec/issues/9173")
24
23
  def test_bullet_points_model(self, client: DocumentationClient):
25
24
  # POST /documentation/lists/bullet-points/model
26
25
  # Expected: 200 OK
@@ -152,3 +152,36 @@ async def test_complex_with_http_part(client: MultiPartClient):
152
152
  @pytest.mark.asyncio
153
153
  async def test_http_parts_non_string_float(client: MultiPartClient):
154
154
  await client.form_data.http_parts.non_string.float(FloatRequest(temperature=0.5))
155
+
156
+
157
+ @pytest.mark.asyncio
158
+ async def test_with_wire_name(client: MultiPartClient):
159
+ await client.form_data.with_wire_name(
160
+ models.MultiPartRequestWithWireName(
161
+ identifier="123",
162
+ image=open(str(JPG), "rb"),
163
+ )
164
+ )
165
+
166
+
167
+ @pytest.mark.asyncio
168
+ async def test_optional_parts(client: MultiPartClient):
169
+ # First time with only id
170
+ await client.form_data.optional_parts(
171
+ models.MultiPartOptionalRequest(
172
+ id="123",
173
+ )
174
+ )
175
+ # Second time with only profileImage
176
+ await client.form_data.optional_parts(
177
+ models.MultiPartOptionalRequest(
178
+ profile_image=open(str(JPG), "rb"),
179
+ )
180
+ )
181
+ # Third time with both id and profileImage
182
+ await client.form_data.optional_parts(
183
+ models.MultiPartOptionalRequest(
184
+ id="123",
185
+ profile_image=open(str(JPG), "rb"),
186
+ )
187
+ )
@@ -41,3 +41,26 @@ async def test_model(client: SpecialWordsClient, special_words):
41
41
  @pytest.mark.asyncio
42
42
  async def test_model_properties(client: SpecialWordsClient):
43
43
  await client.model_properties.same_as_model(model_properties_models.SameAsModel(same_as_model="ok"))
44
+
45
+
46
+ @pytest.mark.asyncio
47
+ async def test_model_properties_dict_methods(client: SpecialWordsClient):
48
+ await client.model_properties.dict_methods(
49
+ body=model_properties_models.DictMethods(
50
+ keys_property="ok",
51
+ items_property="ok",
52
+ values_property="ok",
53
+ popitem_property="ok",
54
+ clear_property="ok",
55
+ update_property="ok",
56
+ setdefault_property="ok",
57
+ pop_property="ok",
58
+ get_property="ok",
59
+ copy_property="ok",
60
+ )
61
+ )
62
+
63
+
64
+ @pytest.mark.asyncio
65
+ async def test_model_properties_with_list(client: SpecialWordsClient):
66
+ await client.model_properties.with_list(model_properties_models.ModelWithList(list="ok"))
@@ -139,3 +139,34 @@ def test_complex_with_http_part(client: MultiPartClient):
139
139
 
140
140
  def test_http_parts_non_string_float(client: MultiPartClient):
141
141
  client.form_data.http_parts.non_string.float(FloatRequest(temperature=0.5))
142
+
143
+
144
+ def test_with_wire_name(client: MultiPartClient):
145
+ client.form_data.with_wire_name(
146
+ models.MultiPartRequestWithWireName(
147
+ identifier="123",
148
+ image=open(str(JPG), "rb"),
149
+ )
150
+ )
151
+
152
+
153
+ def test_optional_parts(client: MultiPartClient):
154
+ # First time with only id
155
+ client.form_data.optional_parts(
156
+ models.MultiPartOptionalRequest(
157
+ id="123",
158
+ )
159
+ )
160
+ # Second time with only profileImage
161
+ client.form_data.optional_parts(
162
+ models.MultiPartOptionalRequest(
163
+ profile_image=open(str(JPG), "rb"),
164
+ )
165
+ )
166
+ # Third time with both id and profileImage
167
+ client.form_data.optional_parts(
168
+ models.MultiPartOptionalRequest(
169
+ id="123",
170
+ profile_image=open(str(JPG), "rb"),
171
+ )
172
+ )
@@ -37,3 +37,24 @@ def test_model(client: SpecialWordsClient, special_words):
37
37
 
38
38
  def test_model_properties(client: SpecialWordsClient):
39
39
  client.model_properties.same_as_model(model_properties_models.SameAsModel(same_as_model="ok"))
40
+
41
+
42
+ def test_model_properties_dict_methods(client: SpecialWordsClient):
43
+ client.model_properties.dict_methods(
44
+ body=model_properties_models.DictMethods(
45
+ keys_property="ok",
46
+ items_property="ok",
47
+ values_property="ok",
48
+ popitem_property="ok",
49
+ clear_property="ok",
50
+ update_property="ok",
51
+ setdefault_property="ok",
52
+ pop_property="ok",
53
+ get_property="ok",
54
+ copy_property="ok",
55
+ )
56
+ )
57
+
58
+
59
+ def test_model_properties_with_list(client: SpecialWordsClient):
60
+ client.model_properties.with_list(model_properties_models.ModelWithList(list="ok"))
@@ -54,6 +54,11 @@ def test_sensitive_word():
54
54
  check_folder = (Path(os.path.dirname(__file__)) / "../generated").resolve()
55
55
  assert [] == check_sensitive_word(check_folder, "azure")
56
56
  # after update spector, it shall also equal to []
57
- assert ["authentication-oauth2", "authentication-union", "setuppy-authentication-union"] == check_sensitive_word(
58
- check_folder, "microsoft"
59
- )
57
+ assert sorted(
58
+ [
59
+ "authentication-oauth2",
60
+ "authentication-noauth-union",
61
+ "authentication-union",
62
+ "setuppy-authentication-union",
63
+ ]
64
+ ) == sorted(check_sensitive_word(check_folder, "microsoft"))
@@ -4,6 +4,7 @@
4
4
  # common test case
5
5
  -e ./generated/authentication-api-key
6
6
  -e ./generated/authentication-http-custom
7
+ -e ./generated/authentication-noauth-union
7
8
  -e ./generated/authentication-oauth2
8
9
  -e ./generated/authentication-union
9
10
  -e ./generated/setuppy-authentication-union