@typespec/http-client-python 0.28.2 → 0.29.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 (368) hide show
  1. package/dist/emitter/code-model.d.ts.map +1 -1
  2. package/dist/emitter/code-model.js +7 -6
  3. package/dist/emitter/code-model.js.map +1 -1
  4. package/dist/emitter/constants.d.ts +6 -0
  5. package/dist/emitter/constants.d.ts.map +1 -0
  6. package/dist/emitter/constants.js +27 -0
  7. package/dist/emitter/constants.js.map +1 -0
  8. package/dist/emitter/emitter.d.ts.map +1 -1
  9. package/dist/emitter/emitter.js +193 -119
  10. package/dist/emitter/emitter.js.map +1 -1
  11. package/dist/emitter/http.d.ts.map +1 -1
  12. package/dist/emitter/http.js +33 -1
  13. package/dist/emitter/http.js.map +1 -1
  14. package/dist/emitter/lib.d.ts +37 -3
  15. package/dist/emitter/lib.d.ts.map +1 -1
  16. package/dist/emitter/lib.js +17 -0
  17. package/dist/emitter/lib.js.map +1 -1
  18. package/dist/emitter/run-python3.js +1 -1
  19. package/dist/emitter/run-python3.js.map +1 -1
  20. package/dist/emitter/system-requirements.js +6 -4
  21. package/dist/emitter/system-requirements.js.map +1 -1
  22. package/dist/emitter/types.d.ts +2 -5
  23. package/dist/emitter/types.d.ts.map +1 -1
  24. package/dist/emitter/types.js +86 -63
  25. package/dist/emitter/types.js.map +1 -1
  26. package/dist/emitter/utils.d.ts.map +1 -1
  27. package/dist/emitter/utils.js +16 -17
  28. package/dist/emitter/utils.js.map +1 -1
  29. package/emitter/src/code-model.ts +7 -13
  30. package/emitter/src/constants.ts +27 -0
  31. package/emitter/src/emitter.ts +241 -123
  32. package/emitter/src/http.ts +29 -1
  33. package/emitter/src/lib.ts +24 -0
  34. package/emitter/src/run-python3.ts +1 -1
  35. package/emitter/src/system-requirements.ts +4 -4
  36. package/emitter/src/types.ts +102 -62
  37. package/emitter/src/utils.ts +16 -18
  38. package/emitter/temp/tsconfig.tsbuildinfo +1 -1
  39. package/emitter/test/utils.test.ts +3 -0
  40. package/emitter/tsconfig.build.json +2 -1
  41. package/emitter/tsconfig.json +2 -1
  42. package/eng/scripts/Build-Packages.ps1 +62 -37
  43. package/eng/scripts/Check-GitChanges.ps1 +30 -3
  44. package/eng/scripts/Functions.ps1 +54 -15
  45. package/eng/scripts/Generate.ps1 +42 -8
  46. package/eng/scripts/Generation.psm1 +44 -15
  47. package/eng/scripts/Initialize-Repository.ps1 +29 -11
  48. package/eng/scripts/Test-Packages.ps1 +47 -31
  49. package/eng/scripts/ci/config/eslint-ci.config.mjs +64 -0
  50. package/eng/scripts/ci/{mypy.ini → config/mypy.ini} +1 -1
  51. package/eng/scripts/ci/{pylintrc → config/pylintrc} +1 -1
  52. package/eng/scripts/ci/{pyrightconfig.json → config/pyrightconfig.json} +1 -1
  53. package/eng/scripts/ci/dev_requirements.txt +2 -1
  54. package/eng/scripts/ci/format.ts +232 -2
  55. package/eng/scripts/ci/lint.ts +223 -20
  56. package/eng/scripts/ci/regenerate-common.ts +411 -136
  57. package/eng/scripts/ci/regenerate.ts +247 -101
  58. package/eng/scripts/ci/run-tests.ts +507 -0
  59. package/eng/scripts/ci/run_apiview.py +22 -16
  60. package/eng/scripts/ci/run_mypy.py +34 -23
  61. package/eng/scripts/ci/run_pylint.py +27 -19
  62. package/eng/scripts/ci/run_pyright.py +9 -5
  63. package/eng/scripts/ci/run_sphinx_build.py +24 -9
  64. package/eng/scripts/ci/typecheck.ts +225 -0
  65. package/eng/scripts/ci/util.py +61 -25
  66. package/eng/scripts/ci/utils.ts +5 -5
  67. package/eng/scripts/setup/__pycache__/package_manager.cpython-311.pyc +0 -0
  68. package/eng/scripts/setup/__pycache__/venvtools.cpython-311.pyc +0 -0
  69. package/eng/scripts/setup/build.ts +1 -1
  70. package/eng/scripts/setup/build_pygen_wheel.py +4 -3
  71. package/eng/scripts/setup/install.py +4 -3
  72. package/eng/scripts/setup/install.ts +1 -1
  73. package/eng/scripts/setup/prepare.py +3 -2
  74. package/eng/scripts/setup/prepare.ts +1 -1
  75. package/eng/scripts/setup/run-python3.ts +1 -1
  76. package/eng/scripts/setup/run_batch.py +197 -0
  77. package/eng/scripts/setup/run_tsp.py +3 -3
  78. package/eng/scripts/setup/system-requirements.ts +8 -4
  79. package/eng/scripts/setup/venvtools.py +1 -1
  80. package/generator/build/lib/pygen/__init__.py +1 -3
  81. package/generator/build/lib/pygen/codegen/__init__.py +0 -1
  82. package/generator/build/lib/pygen/codegen/models/base.py +0 -1
  83. package/generator/build/lib/pygen/codegen/models/client.py +2 -1
  84. package/generator/build/lib/pygen/codegen/models/code_model.py +1 -0
  85. package/generator/build/lib/pygen/codegen/models/enum_type.py +0 -1
  86. package/generator/build/lib/pygen/codegen/models/model_type.py +1 -7
  87. package/generator/build/lib/pygen/codegen/models/parameter.py +16 -14
  88. package/generator/build/lib/pygen/codegen/serializers/__init__.py +27 -12
  89. package/generator/build/lib/pygen/codegen/serializers/builder_serializer.py +12 -3
  90. package/generator/build/lib/pygen/codegen/serializers/general_serializer.py +6 -2
  91. package/generator/build/lib/pygen/codegen/serializers/import_serializer.py +17 -4
  92. package/generator/build/lib/pygen/codegen/serializers/parameter_serializer.py +17 -11
  93. package/generator/build/lib/pygen/codegen/templates/model_base.py.jinja2 +176 -71
  94. package/generator/build/lib/pygen/codegen/templates/packaging_templates/README.md.jinja2 +11 -3
  95. package/generator/build/lib/pygen/codegen/templates/packaging_templates/pyproject.toml.jinja2 +1 -1
  96. package/generator/build/lib/pygen/codegen/templates/serialization.py.jinja2 +5 -1
  97. package/generator/build/lib/pygen/preprocess/__init__.py +37 -30
  98. package/generator/component-detection-pip-report.json +7 -7
  99. package/generator/dist/pygen-0.1.0-py3-none-any.whl +0 -0
  100. package/generator/pygen/__init__.py +1 -3
  101. package/generator/pygen/codegen/__init__.py +0 -1
  102. package/generator/pygen/codegen/models/base.py +0 -1
  103. package/generator/pygen/codegen/models/client.py +2 -1
  104. package/generator/pygen/codegen/models/code_model.py +1 -0
  105. package/generator/pygen/codegen/models/enum_type.py +0 -1
  106. package/generator/pygen/codegen/models/model_type.py +1 -7
  107. package/generator/pygen/codegen/models/parameter.py +16 -14
  108. package/generator/pygen/codegen/serializers/__init__.py +27 -12
  109. package/generator/pygen/codegen/serializers/builder_serializer.py +12 -3
  110. package/generator/pygen/codegen/serializers/general_serializer.py +6 -2
  111. package/generator/pygen/codegen/serializers/import_serializer.py +17 -4
  112. package/generator/pygen/codegen/serializers/parameter_serializer.py +17 -11
  113. package/generator/pygen/codegen/templates/model_base.py.jinja2 +176 -71
  114. package/generator/pygen/codegen/templates/packaging_templates/README.md.jinja2 +11 -3
  115. package/generator/pygen/codegen/templates/packaging_templates/pyproject.toml.jinja2 +1 -1
  116. package/generator/pygen/codegen/templates/serialization.py.jinja2 +5 -1
  117. package/generator/pygen/preprocess/__init__.py +37 -30
  118. package/generator/pygen.egg-info/PKG-INFO +1 -2
  119. package/generator/pygen.egg-info/requires.txt +1 -1
  120. package/generator/setup.py +1 -2
  121. package/package.json +63 -42
  122. package/eng/scripts/ci/run-ci.ts +0 -89
  123. package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_commonproperties_async.py +0 -94
  124. package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_largeheader_async.py +0 -30
  125. package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_nonresource_async.py +0 -36
  126. package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_operationtemplates_async.py +0 -205
  127. package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_resource_async.py +0 -478
  128. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_access_async.py +0 -101
  129. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_api_version_header_async.py +0 -18
  130. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_api_version_path_async.py +0 -18
  131. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_api_version_query_async.py +0 -18
  132. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_client_default_value_async.py +0 -46
  133. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_client_initialization_async.py +0 -58
  134. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_client_location_async.py +0 -82
  135. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_deserialize_empty_string_as_null_async.py +0 -20
  136. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_flatten_async.py +0 -115
  137. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_hierrarchy_building_async.py +0 -53
  138. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_next_link_verb_async.py +0 -28
  139. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_override_async.py +0 -106
  140. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_usage_async.py +0 -38
  141. package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_basic_async.py +0 -76
  142. package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_lro_rpc_async.py +0 -22
  143. package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_lro_standard_async.py +0 -39
  144. package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_model_async.py +0 -33
  145. package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_page_async.py +0 -80
  146. package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_scalar_async.py +0 -41
  147. package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_traits_async.py +0 -87
  148. package/generator/test/azure/mock_api_tests/asynctests/test_azure_encode_duration_async.py +0 -19
  149. package/generator/test/azure/mock_api_tests/asynctests/test_azure_example_basic_async.py +0 -30
  150. package/generator/test/azure/mock_api_tests/asynctests/test_azure_payload_pageable_async.py +0 -19
  151. package/generator/test/azure/mock_api_tests/asynctests/test_azure_resource_manager_method_subscription_id_async.py +0 -248
  152. package/generator/test/azure/mock_api_tests/asynctests/test_azure_resource_manager_multi_service_async.py +0 -110
  153. package/generator/test/azure/mock_api_tests/asynctests/test_azure_resource_manager_multi_service_shared_models_async.py +0 -132
  154. package/generator/test/azure/mock_api_tests/asynctests/test_azure_special_headers_client_request_id_async.py +0 -30
  155. package/generator/test/azure/mock_api_tests/asynctests/test_azure_versioning_previewversion_async.py +0 -53
  156. package/generator/test/azure/mock_api_tests/asynctests/test_client_namespace_async.py +0 -34
  157. package/generator/test/azure/mock_api_tests/asynctests/test_client_naming_async.py +0 -69
  158. package/generator/test/azure/mock_api_tests/asynctests/test_client_naming_enum_conflict_async.py +0 -37
  159. package/generator/test/azure/mock_api_tests/asynctests/test_client_overload_async.py +0 -27
  160. package/generator/test/azure/mock_api_tests/asynctests/test_client_structure_async.py +0 -64
  161. package/generator/test/azure/mock_api_tests/asynctests/test_client_structure_clientoperationgroup_async.py +0 -31
  162. package/generator/test/azure/mock_api_tests/asynctests/test_encode_duration_async.py +0 -63
  163. package/generator/test/azure/mock_api_tests/asynctests/test_encode_numeric_async.py +0 -35
  164. package/generator/test/azure/mock_api_tests/asynctests/test_parameters_basic_async.py +0 -24
  165. package/generator/test/azure/mock_api_tests/asynctests/test_parameters_spread_async.py +0 -76
  166. package/generator/test/azure/mock_api_tests/asynctests/test_payload_content_negotiation_async.py +0 -37
  167. package/generator/test/azure/mock_api_tests/asynctests/test_payload_multipart_async.py +0 -216
  168. package/generator/test/azure/mock_api_tests/asynctests/test_resiliency_srv_driven_async.py +0 -130
  169. package/generator/test/azure/mock_api_tests/asynctests/test_serialization_encoded_name_json_async.py +0 -24
  170. package/generator/test/azure/mock_api_tests/asynctests/test_service_multi_service_async.py +0 -31
  171. package/generator/test/azure/mock_api_tests/asynctests/test_special_words_async.py +0 -71
  172. package/generator/test/azure/mock_api_tests/conftest.py +0 -207
  173. package/generator/test/azure/mock_api_tests/data/image.jpg +0 -0
  174. package/generator/test/azure/mock_api_tests/data/image.png +0 -0
  175. package/generator/test/azure/mock_api_tests/test_azure_arm_commonproperties.py +0 -89
  176. package/generator/test/azure/mock_api_tests/test_azure_arm_largeheader.py +0 -27
  177. package/generator/test/azure/mock_api_tests/test_azure_arm_nonresource.py +0 -34
  178. package/generator/test/azure/mock_api_tests/test_azure_arm_operationtemplates.py +0 -180
  179. package/generator/test/azure/mock_api_tests/test_azure_arm_resource.py +0 -436
  180. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_access.py +0 -92
  181. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_api_version_header.py +0 -17
  182. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_api_version_path.py +0 -17
  183. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_api_version_query.py +0 -17
  184. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_client_default_value.py +0 -42
  185. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_client_initialization.py +0 -51
  186. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_client_location.py +0 -70
  187. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_deserialize_empty_string_as_null.py +0 -19
  188. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_flatten.py +0 -104
  189. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_hierrarchy_building.py +0 -45
  190. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_next_link_verb.py +0 -27
  191. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_override.py +0 -102
  192. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_usage.py +0 -32
  193. package/generator/test/azure/mock_api_tests/test_azure_core_basic.py +0 -70
  194. package/generator/test/azure/mock_api_tests/test_azure_core_lro_rpc.py +0 -20
  195. package/generator/test/azure/mock_api_tests/test_azure_core_lro_standard.py +0 -32
  196. package/generator/test/azure/mock_api_tests/test_azure_core_model.py +0 -30
  197. package/generator/test/azure/mock_api_tests/test_azure_core_page.py +0 -71
  198. package/generator/test/azure/mock_api_tests/test_azure_core_scalar.py +0 -35
  199. package/generator/test/azure/mock_api_tests/test_azure_core_traits.py +0 -85
  200. package/generator/test/azure/mock_api_tests/test_azure_encode_duration.py +0 -18
  201. package/generator/test/azure/mock_api_tests/test_azure_example_basic.py +0 -29
  202. package/generator/test/azure/mock_api_tests/test_azure_payload_pageable.py +0 -18
  203. package/generator/test/azure/mock_api_tests/test_azure_resource_manager_method_subscription_id.py +0 -235
  204. package/generator/test/azure/mock_api_tests/test_azure_resource_manager_multi_service.py +0 -104
  205. package/generator/test/azure/mock_api_tests/test_azure_resource_manager_multi_service_shared_models.py +0 -128
  206. package/generator/test/azure/mock_api_tests/test_azure_special_headers_client_request_id.py +0 -29
  207. package/generator/test/azure/mock_api_tests/test_azure_versioning_previewversion.py +0 -50
  208. package/generator/test/azure/mock_api_tests/test_clear_output_folder.py +0 -23
  209. package/generator/test/azure/mock_api_tests/test_client_namespace.py +0 -32
  210. package/generator/test/azure/mock_api_tests/test_client_naming.py +0 -57
  211. package/generator/test/azure/mock_api_tests/test_client_naming_enum_conflict.py +0 -35
  212. package/generator/test/azure/mock_api_tests/test_client_overload.py +0 -25
  213. package/generator/test/azure/mock_api_tests/test_client_structure.py +0 -60
  214. package/generator/test/azure/mock_api_tests/test_client_structure_clientoperationgroup.py +0 -29
  215. package/generator/test/azure/mock_api_tests/test_encode_duration.py +0 -60
  216. package/generator/test/azure/mock_api_tests/test_encode_numeric.py +0 -31
  217. package/generator/test/azure/mock_api_tests/test_model_base_flatten_compatibility.py +0 -251
  218. package/generator/test/azure/mock_api_tests/test_parameters_basic.py +0 -22
  219. package/generator/test/azure/mock_api_tests/test_parameters_spread.py +0 -66
  220. package/generator/test/azure/mock_api_tests/test_payload_content_negotiation.py +0 -33
  221. package/generator/test/azure/mock_api_tests/test_payload_multipart.py +0 -198
  222. package/generator/test/azure/mock_api_tests/test_resiliency_srv_driven.py +0 -124
  223. package/generator/test/azure/mock_api_tests/test_serialization_encoded_name_json.py +0 -21
  224. package/generator/test/azure/mock_api_tests/test_service_multi_service.py +0 -29
  225. package/generator/test/azure/mock_api_tests/test_special_words.py +0 -63
  226. package/generator/test/azure/requirements.txt +0 -125
  227. package/generator/test/azure/tox.ini +0 -64
  228. package/generator/test/data/image.jpg +0 -0
  229. package/generator/test/data/image.png +0 -0
  230. package/generator/test/dev_requirements.txt +0 -8
  231. package/generator/test/generic_mock_api_tests/asynctests/test_authentication_async.py +0 -140
  232. package/generator/test/generic_mock_api_tests/asynctests/test_encode_array_async.py +0 -139
  233. package/generator/test/generic_mock_api_tests/asynctests/test_encode_bytes_async.py +0 -132
  234. package/generator/test/generic_mock_api_tests/asynctests/test_encode_datetime_async.py +0 -127
  235. package/generator/test/generic_mock_api_tests/asynctests/test_headasboolean_async.py +0 -35
  236. package/generator/test/generic_mock_api_tests/asynctests/test_parameters_body_optionality_async.py +0 -30
  237. package/generator/test/generic_mock_api_tests/asynctests/test_parameters_collection_format_async.py +0 -38
  238. package/generator/test/generic_mock_api_tests/asynctests/test_parameters_path_async.py +0 -24
  239. package/generator/test/generic_mock_api_tests/asynctests/test_parameters_query_async.py +0 -18
  240. package/generator/test/generic_mock_api_tests/asynctests/test_payload_json_merge_patch_async.py +0 -98
  241. package/generator/test/generic_mock_api_tests/asynctests/test_payload_media_type_async.py +0 -27
  242. package/generator/test/generic_mock_api_tests/asynctests/test_payload_pageable_async.py +0 -134
  243. package/generator/test/generic_mock_api_tests/asynctests/test_payload_xml_async.py +0 -150
  244. package/generator/test/generic_mock_api_tests/asynctests/test_response_status_code_range_async.py +0 -38
  245. package/generator/test/generic_mock_api_tests/asynctests/test_routes_async.py +0 -331
  246. package/generator/test/generic_mock_api_tests/asynctests/test_server_endpoint_not_defined_async.py +0 -18
  247. package/generator/test/generic_mock_api_tests/asynctests/test_server_path_multiple_async.py +0 -25
  248. package/generator/test/generic_mock_api_tests/asynctests/test_server_path_single_async.py +0 -18
  249. package/generator/test/generic_mock_api_tests/asynctests/test_server_versions_not_versioned_async.py +0 -28
  250. package/generator/test/generic_mock_api_tests/asynctests/test_server_versions_versioned_async.py +0 -34
  251. package/generator/test/generic_mock_api_tests/asynctests/test_special_headers_conditional_request_async.py +0 -38
  252. package/generator/test/generic_mock_api_tests/asynctests/test_special_headers_repeatability_async.py +0 -19
  253. package/generator/test/generic_mock_api_tests/asynctests/test_specs_documentation_async.py +0 -59
  254. package/generator/test/generic_mock_api_tests/asynctests/test_streaming_jsonl_async.py +0 -27
  255. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_array_async.py +0 -127
  256. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_dictionary_async.py +0 -98
  257. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_enum_extensible_async.py +0 -25
  258. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_enum_fixed_async.py +0 -27
  259. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_file_async.py +0 -59
  260. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_empty_async.py +0 -32
  261. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_enum_discriminator_async.py +0 -70
  262. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_nested_discriminator_async.py +0 -85
  263. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_not_discriminated_async.py +0 -34
  264. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_recursive_async.py +0 -34
  265. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_single_discriminator_async.py +0 -67
  266. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_usage_async.py +0 -32
  267. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_visibility_async.py +0 -47
  268. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_property_additionalproperties_async.py +0 -353
  269. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_property_nullable_async.py +0 -110
  270. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_property_optional_async.py +0 -197
  271. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_property_valuetypes_async.py +0 -315
  272. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_scalar_async.py +0 -60
  273. package/generator/test/generic_mock_api_tests/asynctests/test_typetest_union_async.py +0 -90
  274. package/generator/test/generic_mock_api_tests/asynctests/test_versioning_added_async.py +0 -36
  275. package/generator/test/generic_mock_api_tests/asynctests/test_versioning_made_optional_async.py +0 -21
  276. package/generator/test/generic_mock_api_tests/asynctests/test_versioning_removed_async.py +0 -39
  277. package/generator/test/generic_mock_api_tests/asynctests/test_versioning_renamed_from_async.py +0 -29
  278. package/generator/test/generic_mock_api_tests/asynctests/test_versioning_return_type_changed_from_async.py +0 -18
  279. package/generator/test/generic_mock_api_tests/asynctests/test_versioning_type_changed_from_async.py +0 -22
  280. package/generator/test/generic_mock_api_tests/conftest.py +0 -75
  281. package/generator/test/generic_mock_api_tests/data/image.jpg +0 -0
  282. package/generator/test/generic_mock_api_tests/data/image.png +0 -0
  283. package/generator/test/generic_mock_api_tests/test_authentication.py +0 -130
  284. package/generator/test/generic_mock_api_tests/test_encode_array.py +0 -126
  285. package/generator/test/generic_mock_api_tests/test_encode_bytes.py +0 -128
  286. package/generator/test/generic_mock_api_tests/test_encode_datetime.py +0 -123
  287. package/generator/test/generic_mock_api_tests/test_headasboolean.py +0 -33
  288. package/generator/test/generic_mock_api_tests/test_parameters_body_optionality.py +0 -27
  289. package/generator/test/generic_mock_api_tests/test_parameters_collection_format.py +0 -33
  290. package/generator/test/generic_mock_api_tests/test_parameters_path.py +0 -22
  291. package/generator/test/generic_mock_api_tests/test_parameters_query.py +0 -17
  292. package/generator/test/generic_mock_api_tests/test_payload_json_merge_patch.py +0 -93
  293. package/generator/test/generic_mock_api_tests/test_payload_media_type.py +0 -25
  294. package/generator/test/generic_mock_api_tests/test_payload_pageable.py +0 -99
  295. package/generator/test/generic_mock_api_tests/test_payload_xml.py +0 -135
  296. package/generator/test/generic_mock_api_tests/test_response_status_code_range.py +0 -36
  297. package/generator/test/generic_mock_api_tests/test_routes.py +0 -285
  298. package/generator/test/generic_mock_api_tests/test_server_endpoint_not_defined.py +0 -17
  299. package/generator/test/generic_mock_api_tests/test_server_path_multiple.py +0 -21
  300. package/generator/test/generic_mock_api_tests/test_server_path_single.py +0 -17
  301. package/generator/test/generic_mock_api_tests/test_server_versions_not_versioned.py +0 -25
  302. package/generator/test/generic_mock_api_tests/test_server_versions_versioned.py +0 -30
  303. package/generator/test/generic_mock_api_tests/test_special_headers_conditional_request.py +0 -34
  304. package/generator/test/generic_mock_api_tests/test_special_headers_repeatability.py +0 -18
  305. package/generator/test/generic_mock_api_tests/test_specs_documentation.py +0 -51
  306. package/generator/test/generic_mock_api_tests/test_streaming_jsonl.py +0 -25
  307. package/generator/test/generic_mock_api_tests/test_typetest_array.py +0 -111
  308. package/generator/test/generic_mock_api_tests/test_typetest_dictionary.py +0 -86
  309. package/generator/test/generic_mock_api_tests/test_typetest_enum_extensible.py +0 -23
  310. package/generator/test/generic_mock_api_tests/test_typetest_enum_fixed.py +0 -25
  311. package/generator/test/generic_mock_api_tests/test_typetest_file.py +0 -52
  312. package/generator/test/generic_mock_api_tests/test_typetest_model_empty.py +0 -29
  313. package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_enum_discriminator.py +0 -58
  314. package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_nested_discriminator.py +0 -79
  315. package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_not_discriminated.py +0 -31
  316. package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_recursive.py +0 -32
  317. package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_single_discriminator.py +0 -60
  318. package/generator/test/generic_mock_api_tests/test_typetest_model_usage.py +0 -28
  319. package/generator/test/generic_mock_api_tests/test_typetest_model_visibility.py +0 -40
  320. package/generator/test/generic_mock_api_tests/test_typetest_property_additionalproperties.py +0 -314
  321. package/generator/test/generic_mock_api_tests/test_typetest_property_nullable.py +0 -102
  322. package/generator/test/generic_mock_api_tests/test_typetest_property_optional.py +0 -174
  323. package/generator/test/generic_mock_api_tests/test_typetest_property_valuetypes.py +0 -286
  324. package/generator/test/generic_mock_api_tests/test_typetest_scalar.py +0 -53
  325. package/generator/test/generic_mock_api_tests/test_typetest_union.py +0 -80
  326. package/generator/test/generic_mock_api_tests/test_typetest_union_discriminated.py +0 -290
  327. package/generator/test/generic_mock_api_tests/test_versioning_added.py +0 -33
  328. package/generator/test/generic_mock_api_tests/test_versioning_made_optional.py +0 -20
  329. package/generator/test/generic_mock_api_tests/test_versioning_removed.py +0 -37
  330. package/generator/test/generic_mock_api_tests/test_versioning_renamed_from.py +0 -27
  331. package/generator/test/generic_mock_api_tests/test_versioning_return_type_changed_from.py +0 -17
  332. package/generator/test/generic_mock_api_tests/test_versioning_type_changed_from.py +0 -21
  333. package/generator/test/unbranded/mock_api_tests/asynctests/test_auth_flow_async.py +0 -19
  334. package/generator/test/unbranded/mock_api_tests/asynctests/test_encode_duration_async.py +0 -63
  335. package/generator/test/unbranded/mock_api_tests/asynctests/test_encode_numeric_async.py +0 -35
  336. package/generator/test/unbranded/mock_api_tests/asynctests/test_parameters_basic_async.py +0 -24
  337. package/generator/test/unbranded/mock_api_tests/asynctests/test_parameters_spread_async.py +0 -76
  338. package/generator/test/unbranded/mock_api_tests/asynctests/test_payload_content_negotiation_async.py +0 -37
  339. package/generator/test/unbranded/mock_api_tests/asynctests/test_payload_multipart_async.py +0 -218
  340. package/generator/test/unbranded/mock_api_tests/asynctests/test_serialization_encoded_name_json_async.py +0 -24
  341. package/generator/test/unbranded/mock_api_tests/asynctests/test_special_words_async.py +0 -73
  342. package/generator/test/unbranded/mock_api_tests/asynctests/test_unbranded_async.py +0 -24
  343. package/generator/test/unbranded/mock_api_tests/conftest.py +0 -91
  344. package/generator/test/unbranded/mock_api_tests/data/image.jpg +0 -0
  345. package/generator/test/unbranded/mock_api_tests/data/image.png +0 -0
  346. package/generator/test/unbranded/mock_api_tests/test_auth_flow.py +0 -17
  347. package/generator/test/unbranded/mock_api_tests/test_encode_duration.py +0 -60
  348. package/generator/test/unbranded/mock_api_tests/test_encode_numeric.py +0 -32
  349. package/generator/test/unbranded/mock_api_tests/test_parameters_basic.py +0 -22
  350. package/generator/test/unbranded/mock_api_tests/test_parameters_spread.py +0 -66
  351. package/generator/test/unbranded/mock_api_tests/test_payload_content_negotiation.py +0 -33
  352. package/generator/test/unbranded/mock_api_tests/test_payload_multipart.py +0 -200
  353. package/generator/test/unbranded/mock_api_tests/test_serialization_encoded_name_json.py +0 -22
  354. package/generator/test/unbranded/mock_api_tests/test_special_words.py +0 -66
  355. package/generator/test/unbranded/mock_api_tests/test_unbranded.py +0 -65
  356. package/generator/test/unbranded/requirements.txt +0 -69
  357. package/generator/test/unbranded/tox.ini +0 -64
  358. package/generator/test/unittests/conftest.py +0 -15
  359. package/generator/test/unittests/requirements.txt +0 -3
  360. package/generator/test/unittests/test_enums.py +0 -89
  361. package/generator/test/unittests/test_model_base_serialization.py +0 -4906
  362. package/generator/test/unittests/test_model_base_xml_serialization.py +0 -1239
  363. package/generator/test/unittests/test_name_converter.py +0 -35
  364. package/generator/test/unittests/test_optional_return_type.py +0 -268
  365. package/generator/test/unittests/test_parameter_ordering.py +0 -104
  366. package/generator/test/unittests/test_sort_schema.py +0 -93
  367. package/generator/test/unittests/tox.ini +0 -5
  368. /package/eng/scripts/ci/{pyproject.toml → config/pyproject.toml} +0 -0
@@ -1,127 +0,0 @@
1
- # -------------------------------------------------------------------------
2
- # Copyright (c) Microsoft Corporation. All rights reserved.
3
- # Licensed under the MIT License. See License.txt in the project root for
4
- # license information.
5
- # --------------------------------------------------------------------------
6
-
7
- import pytest
8
- import isodate
9
- from typetest.array.aio import ArrayClient
10
- from typetest.array import models
11
-
12
-
13
- @pytest.fixture
14
- async def client():
15
- async with ArrayClient() as client:
16
- yield client
17
-
18
-
19
- @pytest.mark.asyncio
20
- async def test_boolean_value(client: ArrayClient):
21
- assert await client.boolean_value.get() == [True, False]
22
- await client.boolean_value.put([True, False])
23
-
24
-
25
- @pytest.mark.asyncio
26
- async def test_datetime_value(client: ArrayClient):
27
- assert await client.datetime_value.get() == [isodate.parse_datetime("2022-08-26T18:38:00Z")]
28
- await client.datetime_value.put([isodate.parse_datetime("2022-08-26T18:38:00Z")])
29
-
30
-
31
- @pytest.mark.asyncio
32
- async def test_duration_value(client: ArrayClient):
33
- assert await client.duration_value.get() == [isodate.parse_duration("P123DT22H14M12.011S")]
34
- await client.duration_value.put([isodate.parse_duration("P123DT22H14M12.011S")])
35
-
36
-
37
- @pytest.mark.asyncio
38
- async def test_float32_value(client: ArrayClient):
39
- assert await client.float32_value.get() == [43.125]
40
- await client.float32_value.put([43.125])
41
-
42
-
43
- @pytest.mark.asyncio
44
- async def test_int32_value(client: ArrayClient):
45
- assert await client.int32_value.get() == [1, 2]
46
- await client.int32_value.put([1, 2])
47
-
48
-
49
- @pytest.mark.asyncio
50
- async def test_int64_value(client: ArrayClient):
51
- assert await client.int64_value.get() == [2**53 - 1, -(2**53 - 1)]
52
- await client.int64_value.put([2**53 - 1, -(2**53 - 1)])
53
-
54
-
55
- @pytest.mark.asyncio
56
- async def test_model_value(client: ArrayClient):
57
- assert await client.model_value.get() == [
58
- models.InnerModel(property="hello"),
59
- models.InnerModel(property="world"),
60
- ]
61
- # test list[model]
62
- await client.model_value.put(
63
- [
64
- models.InnerModel(property="hello"),
65
- models.InnerModel(property="world"),
66
- ]
67
- )
68
-
69
- # test list[JSON]
70
- await client.model_value.put(
71
- [
72
- {"property": "hello"},
73
- {"property": "world"},
74
- ]
75
- )
76
-
77
-
78
- @pytest.mark.asyncio
79
- async def test_nullable_boolean_value(client: ArrayClient):
80
- assert await client.nullable_boolean_value.get() == [True, None, False]
81
- await client.nullable_boolean_value.put([True, None, False])
82
-
83
-
84
- @pytest.mark.asyncio
85
- async def test_nullable_float_value(client: ArrayClient):
86
- assert await client.nullable_float_value.get() == [1.25, None, 3.0]
87
- await client.nullable_float_value.put([1.25, None, 3.0])
88
-
89
-
90
- @pytest.mark.asyncio
91
- async def test_nullable_int32_value(client: ArrayClient):
92
- assert await client.nullable_int32_value.get() == [1, None, 3]
93
- await client.nullable_int32_value.put([1, None, 3])
94
-
95
-
96
- @pytest.mark.asyncio
97
- async def test_nullable_model_value(client: ArrayClient):
98
- assert await client.nullable_model_value.get() == [
99
- models.InnerModel(property="hello"),
100
- None,
101
- models.InnerModel(property="world"),
102
- ]
103
- await client.nullable_model_value.put(
104
- [
105
- models.InnerModel(property="hello"),
106
- None,
107
- models.InnerModel(property="world"),
108
- ]
109
- )
110
-
111
-
112
- @pytest.mark.asyncio
113
- async def test_nullable_string_value(client: ArrayClient):
114
- assert await client.nullable_string_value.get() == ["hello", None, "world"]
115
- await client.nullable_string_value.put(["hello", None, "world"])
116
-
117
-
118
- @pytest.mark.asyncio
119
- async def test_string_value(client: ArrayClient):
120
- assert await client.string_value.get() == ["hello", ""]
121
- await client.string_value.put(["hello", ""])
122
-
123
-
124
- @pytest.mark.asyncio
125
- async def test_unknown_value(client: ArrayClient):
126
- assert await client.unknown_value.get() == [1, "hello", None]
127
- await client.unknown_value.put([1, "hello", None])
@@ -1,98 +0,0 @@
1
- # -------------------------------------------------------------------------
2
- # Copyright (c) Microsoft Corporation. All rights reserved.
3
- # Licensed under the MIT License. See License.txt in the project root for
4
- # license information.
5
- # --------------------------------------------------------------------------
6
- import pytest
7
- from typetest.dictionary import models
8
- from typetest.dictionary.aio import DictionaryClient
9
- import isodate
10
-
11
-
12
- @pytest.fixture
13
- async def client():
14
- async with DictionaryClient() as client:
15
- yield client
16
-
17
-
18
- @pytest.mark.asyncio
19
- async def test_boolean_value(client: DictionaryClient):
20
- value = {"k1": True, "k2": False}
21
- assert await client.boolean_value.get() == value
22
- await client.boolean_value.put(value)
23
-
24
-
25
- @pytest.mark.asyncio
26
- async def test_datetime_value(client: DictionaryClient):
27
- value = {"k1": isodate.parse_datetime("2022-08-26T18:38:00Z")}
28
- assert await client.datetime_value.get() == value
29
- await client.datetime_value.put(value)
30
-
31
-
32
- @pytest.mark.asyncio
33
- async def test_duration_value(client: DictionaryClient):
34
- value = {"k1": isodate.parse_duration("P123DT22H14M12.011S")}
35
- assert await client.duration_value.get() == value
36
- await client.duration_value.put(value)
37
-
38
-
39
- @pytest.mark.asyncio
40
- async def test_float32_value(client: DictionaryClient):
41
- value = {"k1": 43.125}
42
- assert await client.float32_value.get() == value
43
- await client.float32_value.put(value)
44
-
45
-
46
- @pytest.mark.asyncio
47
- async def test_int32_value(client: DictionaryClient):
48
- value = {"k1": 1, "k2": 2}
49
- assert await client.int32_value.get() == value
50
- await client.int32_value.put(value)
51
-
52
-
53
- @pytest.mark.asyncio
54
- async def test_int64_value(client: DictionaryClient):
55
- value = {"k1": 2**53 - 1, "k2": -(2**53 - 1)}
56
- assert await client.int64_value.get() == value
57
- await client.int64_value.put(value)
58
-
59
-
60
- @pytest.mark.asyncio
61
- async def test_model_value(client: DictionaryClient):
62
- value = {
63
- "k1": models.InnerModel(property="hello"),
64
- "k2": models.InnerModel(property="world"),
65
- }
66
- assert await client.model_value.get() == value
67
- await client.model_value.put(value)
68
-
69
-
70
- @pytest.mark.asyncio
71
- async def test_nullable_float_value(client: DictionaryClient):
72
- value = {"k1": 1.25, "k2": 0.5, "k3": None}
73
- assert await client.nullable_float_value.get() == value
74
- await client.nullable_float_value.put(value)
75
-
76
-
77
- @pytest.mark.asyncio
78
- async def test_recursive_model_value(client: DictionaryClient):
79
- value = {
80
- "k1": models.InnerModel(property="hello", children={}),
81
- "k2": models.InnerModel(property="world", children={"k2.1": models.InnerModel(property="inner world")}),
82
- }
83
- assert await client.recursive_model_value.get() == value
84
- await client.recursive_model_value.put(value)
85
-
86
-
87
- @pytest.mark.asyncio
88
- async def test_string_value(client: DictionaryClient):
89
- value = {"k1": "hello", "k2": ""}
90
- assert await client.string_value.get() == value
91
- await client.string_value.put(value)
92
-
93
-
94
- @pytest.mark.asyncio
95
- async def test_unknown_value(client: DictionaryClient):
96
- value = {"k1": 1, "k2": "hello", "k3": None}
97
- assert await client.unknown_value.get() == value
98
- await client.unknown_value.put(value)
@@ -1,25 +0,0 @@
1
- # -------------------------------------------------------------------------
2
- # Copyright (c) Microsoft Corporation. All rights reserved.
3
- # Licensed under the MIT License. See License.txt in the project root for
4
- # license information.
5
- # --------------------------------------------------------------------------
6
- import pytest
7
- from typetest.enum.extensible import models, aio
8
-
9
-
10
- @pytest.fixture
11
- async def client():
12
- async with aio.ExtensibleClient() as client:
13
- yield client
14
-
15
-
16
- @pytest.mark.asyncio
17
- async def test_known_value(client):
18
- assert await client.string.get_known_value() == models.DaysOfWeekExtensibleEnum.MONDAY
19
- await client.string.put_known_value(models.DaysOfWeekExtensibleEnum.MONDAY)
20
-
21
-
22
- @pytest.mark.asyncio
23
- async def test_unknown_value(client):
24
- assert await client.string.get_unknown_value() == "Weekend"
25
- await client.string.put_unknown_value("Weekend")
@@ -1,27 +0,0 @@
1
- # -------------------------------------------------------------------------
2
- # Copyright (c) Microsoft Corporation. All rights reserved.
3
- # Licensed under the MIT License. See License.txt in the project root for
4
- # license information.
5
- # --------------------------------------------------------------------------
6
- import pytest
7
- from typetest.enum.fixed import aio, models
8
-
9
-
10
- @pytest.fixture
11
- async def client():
12
- async with aio.FixedClient() as client:
13
- yield client
14
-
15
-
16
- @pytest.mark.asyncio
17
- async def test_known_value(client):
18
- assert await client.string.get_known_value() == models.DaysOfWeekEnum.MONDAY
19
- await client.string.put_known_value(models.DaysOfWeekEnum.MONDAY)
20
-
21
-
22
- @pytest.mark.asyncio
23
- async def test_unknown_value(client: aio.FixedClient, core_library):
24
- try:
25
- await client.string.put_unknown_value("Weekend")
26
- except core_library.exceptions.HttpResponseError as err:
27
- assert err.status_code == 500
@@ -1,59 +0,0 @@
1
- # -------------------------------------------------------------------------
2
- # Copyright (c) Microsoft Corporation. All rights reserved.
3
- # Licensed under the MIT License. See License.txt in the project root for
4
- # license information.
5
- # --------------------------------------------------------------------------
6
- # after we support Http.File case, enable these tests again
7
-
8
-
9
- # import json
10
-
11
- # import pytest
12
- # from typetest.file.aio import FileClient
13
-
14
-
15
- # @pytest.fixture
16
- # async def client():
17
- # async with FileClient(endpoint="http://localhost:3000") as client:
18
- # yield client
19
-
20
-
21
- # @pytest.mark.asyncio
22
- # async def test_upload_file_specific_content_type(client: FileClient, png_data: bytes):
23
- # await client.body.upload_file_specific_content_type(png_data)
24
-
25
-
26
- # # Do not support this case for now
27
- # # @pytest.mark.asyncio
28
- # # async def test_upload_file_json_content_type(client: FileClient):
29
- # # await client.body.upload_file_json_content_type(json.dumps({"message": "test file content"}).encode())
30
-
31
-
32
- # # although result is expected but actually there is deserialization issue
33
- # # @pytest.mark.asyncio
34
- # # async def test_download_file_json_content_type(client: FileClient):
35
- # # result = await client.body.download_file_json_content_type()
36
- # # assert result == {"message": "test file content"}
37
-
38
-
39
- # @pytest.mark.asyncio
40
- # async def test_download_file_specific_content_type(client: FileClient, png_data: bytes):
41
- # result = b"".join([d async for d in (await client.body.download_file_specific_content_type())])
42
- # assert result == png_data
43
-
44
-
45
- # @pytest.mark.asyncio
46
- # async def test_download_file_multiple_content_types(client: FileClient, png_data: bytes):
47
- # result = b"".join([d async for d in (await client.body.download_file_multiple_content_types())])
48
- # assert result == png_data
49
-
50
-
51
- # @pytest.mark.asyncio
52
- # async def test_upload_file_default_content_type(client: FileClient, png_data: bytes):
53
- # await client.body.upload_file_default_content_type(png_data, content_type="image/png")
54
-
55
-
56
- # @pytest.mark.asyncio
57
- # async def test_download_file_default_content_type(client: FileClient, png_data: bytes):
58
- # result = b"".join([d async for d in (await client.body.download_file_default_content_type())])
59
- # assert result == png_data
@@ -1,32 +0,0 @@
1
- # -------------------------------------------------------------------------
2
- # Copyright (c) Microsoft Corporation. All rights reserved.
3
- # Licensed under the MIT License. See License.txt in the project root for
4
- # license information.
5
- # --------------------------------------------------------------------------
6
- import pytest
7
- from typetest.model.empty.aio import EmptyClient
8
- from typetest.model.empty.models import EmptyInput, EmptyOutput, EmptyInputOutput
9
-
10
-
11
- @pytest.fixture
12
- async def client():
13
- async with EmptyClient() as client:
14
- yield client
15
-
16
-
17
- @pytest.mark.asyncio
18
- async def test_put(client: EmptyClient):
19
- await client.put_empty(EmptyInput())
20
- await client.put_empty({})
21
-
22
-
23
- @pytest.mark.asyncio
24
- async def test_get(client: EmptyClient):
25
- assert await client.get_empty() == EmptyOutput()
26
- assert await client.get_empty() == {}
27
-
28
-
29
- @pytest.mark.asyncio
30
- async def test_post_round(client: EmptyClient):
31
- assert await client.post_round_trip_empty(EmptyInputOutput()) == EmptyInputOutput()
32
- assert await client.post_round_trip_empty({}) == {}
@@ -1,70 +0,0 @@
1
- # -------------------------------------------------------------------------
2
- # Copyright (c) Microsoft Corporation. All rights reserved.
3
- # Licensed under the MIT License. See License.txt in the project root for
4
- # license information.
5
- # --------------------------------------------------------------------------
6
- import pytest
7
- from typetest.model.enumdiscriminator.aio import EnumDiscriminatorClient
8
- from typetest.model.enumdiscriminator import models
9
-
10
-
11
- @pytest.fixture
12
- async def client():
13
- async with EnumDiscriminatorClient() as client:
14
- yield client
15
-
16
-
17
- @pytest.fixture
18
- def valid_body():
19
- return models.Golden(weight=10)
20
-
21
-
22
- @pytest.fixture
23
- def valid_fixed_body():
24
- return models.Cobra(length=10)
25
-
26
-
27
- @pytest.mark.asyncio
28
- async def test_get_extensible_model(client: EnumDiscriminatorClient, valid_body: models.Dog):
29
- assert await client.get_extensible_model() == valid_body
30
- assert isinstance(await client.get_extensible_model(), models.Golden)
31
-
32
-
33
- @pytest.mark.asyncio
34
- async def test_put_extensible_model(client: EnumDiscriminatorClient, valid_body: models.Dog):
35
- await client.put_extensible_model(valid_body)
36
-
37
-
38
- @pytest.mark.asyncio
39
- async def test_get_extensible_model_missing_discriminator(
40
- client: EnumDiscriminatorClient,
41
- ):
42
- assert await client.get_extensible_model_missing_discriminator() == models.Dog(weight=10)
43
-
44
-
45
- @pytest.mark.asyncio
46
- async def test_get_extensible_model_wrong_discriminator(
47
- client: EnumDiscriminatorClient,
48
- ):
49
- assert await client.get_extensible_model_wrong_discriminator() == models.Dog(weight=8, kind="wrongKind")
50
-
51
-
52
- @pytest.mark.asyncio
53
- async def test_get_fixed_model(client: EnumDiscriminatorClient, valid_fixed_body: models.Snake):
54
- assert await client.get_fixed_model() == valid_fixed_body
55
- assert isinstance(await client.get_fixed_model(), models.Cobra)
56
-
57
-
58
- @pytest.mark.asyncio
59
- async def test_put_fixed_model(client: EnumDiscriminatorClient, valid_fixed_body: models.Snake):
60
- await client.put_fixed_model(valid_fixed_body)
61
-
62
-
63
- @pytest.mark.asyncio
64
- async def test_get_fixed_model_missing_discriminator(client: EnumDiscriminatorClient):
65
- assert await client.get_fixed_model_missing_discriminator() == models.Snake(length=10)
66
-
67
-
68
- @pytest.mark.asyncio
69
- async def test_get_fixed_model_wrong_discriminator(client: EnumDiscriminatorClient):
70
- assert await client.get_fixed_model_wrong_discriminator() == models.Snake(length=8, kind="wrongKind")
@@ -1,85 +0,0 @@
1
- # -------------------------------------------------------------------------
2
- # Copyright (c) Microsoft Corporation. All rights reserved.
3
- # Licensed under the MIT License. See License.txt in the project root for
4
- # license information.
5
- # --------------------------------------------------------------------------
6
- import pytest
7
- from typetest.model.nesteddiscriminator.aio import NestedDiscriminatorClient
8
- from typetest.model.nesteddiscriminator.models import GoblinShark, Salmon, Fish
9
-
10
-
11
- @pytest.fixture
12
- async def client():
13
- async with NestedDiscriminatorClient() as client:
14
- yield client
15
-
16
-
17
- @pytest.fixture
18
- async def valid_body():
19
- return GoblinShark(age=1)
20
-
21
-
22
- @pytest.mark.asyncio
23
- async def test_get_model(client, valid_body):
24
- assert await client.get_model() == valid_body
25
- assert isinstance(await client.get_model(), GoblinShark)
26
-
27
-
28
- @pytest.mark.asyncio
29
- async def test_put_model(client, valid_body):
30
- await client.put_model(valid_body)
31
-
32
-
33
- @pytest.fixture
34
- async def valid_recursive_body():
35
- return Salmon(
36
- {
37
- "age": 1,
38
- "kind": "salmon",
39
- "partner": {"age": 2, "kind": "shark", "sharktype": "saw"},
40
- "friends": [
41
- {
42
- "age": 2,
43
- "kind": "salmon",
44
- "partner": {"age": 3, "kind": "salmon"},
45
- "hate": {
46
- "key1": {"age": 4, "kind": "salmon"},
47
- "key2": {"age": 2, "kind": "shark", "sharktype": "goblin"},
48
- },
49
- },
50
- {"age": 3, "kind": "shark", "sharktype": "goblin"},
51
- ],
52
- "hate": {
53
- "key3": {"age": 3, "kind": "shark", "sharktype": "saw"},
54
- "key4": {
55
- "age": 2,
56
- "kind": "salmon",
57
- "friends": [
58
- {"age": 1, "kind": "salmon"},
59
- {"age": 4, "kind": "shark", "sharktype": "goblin"},
60
- ],
61
- },
62
- },
63
- }
64
- )
65
-
66
-
67
- @pytest.mark.asyncio
68
- async def test_get_recursive_model(client, valid_recursive_body):
69
- assert valid_recursive_body == await client.get_recursive_model()
70
- assert isinstance(await client.get_recursive_model(), Salmon)
71
-
72
-
73
- @pytest.mark.asyncio
74
- async def test_put_recursive_model(client, valid_recursive_body):
75
- await client.put_recursive_model(valid_recursive_body)
76
-
77
-
78
- @pytest.mark.asyncio
79
- async def test_get_missing_discriminator(client):
80
- assert await client.get_missing_discriminator() == Fish(age=1)
81
-
82
-
83
- @pytest.mark.asyncio
84
- async def test_get_wrong_discriminator(client):
85
- assert await client.get_wrong_discriminator() == Fish(age=1, kind="wrongKind")
@@ -1,34 +0,0 @@
1
- # -------------------------------------------------------------------------
2
- # Copyright (c) Microsoft Corporation. All rights reserved.
3
- # Licensed under the MIT License. See License.txt in the project root for
4
- # license information.
5
- # --------------------------------------------------------------------------
6
- import pytest
7
- from typetest.model.notdiscriminated.aio import NotDiscriminatedClient
8
- from typetest.model.notdiscriminated.models import Siamese
9
-
10
-
11
- @pytest.fixture
12
- async def client():
13
- async with NotDiscriminatedClient() as client:
14
- yield client
15
-
16
-
17
- @pytest.fixture
18
- async def valid_body():
19
- return Siamese(name="abc", age=32, smart=True)
20
-
21
-
22
- @pytest.mark.asyncio
23
- async def test_get_valid(client, valid_body):
24
- assert await client.get_valid() == valid_body
25
-
26
-
27
- @pytest.mark.asyncio
28
- async def test_post_valid(client, valid_body):
29
- await client.post_valid(valid_body)
30
-
31
-
32
- @pytest.mark.asyncio
33
- async def test_put_valid(client, valid_body):
34
- assert valid_body == await client.put_valid(valid_body)
@@ -1,34 +0,0 @@
1
- # -------------------------------------------------------------------------
2
- # Copyright (c) Microsoft Corporation. All rights reserved.
3
- # Licensed under the MIT License. See License.txt in the project root for
4
- # license information.
5
- # --------------------------------------------------------------------------
6
- import pytest
7
- from typetest.model.recursive.aio import RecursiveClient
8
- from typetest.model.recursive.models import Extension
9
-
10
-
11
- @pytest.fixture
12
- async def client():
13
- async with RecursiveClient() as client:
14
- yield client
15
-
16
-
17
- @pytest.fixture
18
- async def expected():
19
- return Extension(
20
- {
21
- "level": 0,
22
- "extension": [{"level": 1, "extension": [{"level": 2}]}, {"level": 1}],
23
- }
24
- )
25
-
26
-
27
- @pytest.mark.asyncio
28
- async def test_put(client: RecursiveClient, expected: Extension):
29
- await client.put(expected)
30
-
31
-
32
- @pytest.mark.asyncio
33
- async def test_get(client: RecursiveClient, expected: Extension):
34
- assert await client.get() == expected
@@ -1,67 +0,0 @@
1
- # -------------------------------------------------------------------------
2
- # Copyright (c) Microsoft Corporation. All rights reserved.
3
- # Licensed under the MIT License. See License.txt in the project root for
4
- # license information.
5
- # --------------------------------------------------------------------------
6
- import pytest
7
- from typetest.model.singlediscriminator.aio import SingleDiscriminatorClient
8
- from typetest.model.singlediscriminator.models import Sparrow, Eagle, Bird, Dinosaur
9
-
10
-
11
- @pytest.fixture
12
- async def client():
13
- async with SingleDiscriminatorClient() as client:
14
- yield client
15
-
16
-
17
- @pytest.fixture
18
- async def valid_body():
19
- return Sparrow(wingspan=1)
20
-
21
-
22
- @pytest.mark.asyncio
23
- async def test_get_model(client, valid_body):
24
- assert await client.get_model() == valid_body
25
-
26
-
27
- @pytest.mark.asyncio
28
- async def test_put_model(client, valid_body):
29
- await client.put_model(valid_body)
30
-
31
-
32
- @pytest.fixture
33
- async def recursive_body():
34
- return Eagle(
35
- {
36
- "wingspan": 5,
37
- "kind": "eagle",
38
- "partner": {"wingspan": 2, "kind": "goose"},
39
- "friends": [{"wingspan": 2, "kind": "seagull"}],
40
- "hate": {"key3": {"wingspan": 1, "kind": "sparrow"}},
41
- }
42
- )
43
-
44
-
45
- @pytest.mark.asyncio
46
- async def test_get_recursive_model(client, recursive_body):
47
- assert await client.get_recursive_model() == recursive_body
48
-
49
-
50
- @pytest.mark.asyncio
51
- async def test_put_recursive_model(client, recursive_body):
52
- await client.put_recursive_model(recursive_body)
53
-
54
-
55
- @pytest.mark.asyncio
56
- async def test_get_missing_discriminator(client):
57
- assert await client.get_missing_discriminator() == Bird(wingspan=1)
58
-
59
-
60
- @pytest.mark.asyncio
61
- async def test_get_wrong_discriminator(client):
62
- assert await client.get_wrong_discriminator() == Bird(wingspan=1, kind="wrongKind")
63
-
64
-
65
- @pytest.mark.asyncio
66
- async def test_get_legacy_model(client):
67
- assert await client.get_legacy_model() == Dinosaur(size=20, kind="t-rex")