@typespec/http-client-python 0.28.1 → 0.28.3
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.
- package/dist/emitter/code-model.d.ts.map +1 -1
- package/dist/emitter/code-model.js +6 -6
- package/dist/emitter/code-model.js.map +1 -1
- package/dist/emitter/emitter.d.ts.map +1 -1
- package/dist/emitter/emitter.js +27 -28
- package/dist/emitter/emitter.js.map +1 -1
- package/dist/emitter/lib.d.ts +4 -1
- package/dist/emitter/lib.d.ts.map +1 -1
- package/dist/emitter/lib.js.map +1 -1
- package/dist/emitter/system-requirements.js +6 -4
- package/dist/emitter/system-requirements.js.map +1 -1
- package/dist/emitter/types.d.ts +2 -5
- package/dist/emitter/types.d.ts.map +1 -1
- package/dist/emitter/types.js +55 -58
- package/dist/emitter/types.js.map +1 -1
- package/dist/emitter/utils.d.ts.map +1 -1
- package/dist/emitter/utils.js +16 -17
- package/dist/emitter/utils.js.map +1 -1
- package/emitter/src/code-model.ts +6 -13
- package/emitter/src/emitter.ts +29 -31
- package/emitter/src/lib.ts +4 -0
- package/emitter/src/system-requirements.ts +4 -4
- package/emitter/src/types.ts +67 -57
- package/emitter/src/utils.ts +16 -18
- package/emitter/temp/tsconfig.tsbuildinfo +1 -1
- package/eng/scripts/Build-Packages.ps1 +62 -37
- package/eng/scripts/Check-GitChanges.ps1 +30 -3
- package/eng/scripts/Functions.ps1 +54 -15
- package/eng/scripts/Generate.ps1 +42 -8
- package/eng/scripts/Generation.psm1 +44 -15
- package/eng/scripts/Initialize-Repository.ps1 +29 -11
- package/eng/scripts/Test-Packages.ps1 +47 -31
- package/eng/scripts/ci/config/eslint-ci.config.mjs +54 -0
- package/eng/scripts/ci/dev_requirements.txt +1 -0
- package/eng/scripts/ci/format.ts +232 -2
- package/eng/scripts/ci/lint.ts +216 -20
- package/eng/scripts/ci/regenerate-common.ts +18 -14
- package/eng/scripts/ci/regenerate.ts +305 -68
- package/eng/scripts/ci/run-tests.ts +402 -0
- package/eng/scripts/ci/run_mypy.py +4 -3
- package/eng/scripts/ci/run_pylint.py +4 -3
- package/eng/scripts/ci/run_pyright.py +4 -3
- package/eng/scripts/ci/typecheck.ts +225 -0
- package/eng/scripts/ci/util.py +1 -1
- package/eng/scripts/ci/utils.ts +5 -5
- package/eng/scripts/setup/__pycache__/package_manager.cpython-311.pyc +0 -0
- package/eng/scripts/setup/__pycache__/venvtools.cpython-311.pyc +0 -0
- package/eng/scripts/setup/build.ts +1 -1
- package/eng/scripts/setup/build_pygen_wheel.py +1 -0
- package/eng/scripts/setup/install.py +1 -0
- package/eng/scripts/setup/prepare.py +1 -0
- package/eng/scripts/setup/prepare.ts +1 -1
- package/eng/scripts/setup/run_tsp.py +3 -3
- package/eng/scripts/setup/system-requirements.ts +8 -4
- package/eng/scripts/setup/venvtools.py +1 -0
- package/generator/build/lib/pygen/codegen/models/operation.py +9 -8
- package/generator/build/lib/pygen/codegen/templates/model_base.py.jinja2 +157 -64
- package/generator/dist/pygen-0.1.0-py3-none-any.whl +0 -0
- package/generator/pygen/codegen/models/operation.py +9 -8
- package/generator/pygen/codegen/templates/model_base.py.jinja2 +157 -64
- package/package.json +48 -42
- package/eng/scripts/ci/run-ci.ts +0 -89
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_commonproperties_async.py +0 -94
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_largeheader_async.py +0 -30
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_nonresource_async.py +0 -36
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_operationtemplates_async.py +0 -205
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_arm_resource_async.py +0 -478
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_access_async.py +0 -101
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_api_version_header_async.py +0 -18
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_api_version_path_async.py +0 -18
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_api_version_query_async.py +0 -18
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_client_default_value_async.py +0 -46
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_client_initialization_async.py +0 -58
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_client_location_async.py +0 -82
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_deserialize_empty_string_as_null_async.py +0 -20
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_flatten_async.py +0 -115
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_hierrarchy_building_async.py +0 -53
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_next_link_verb_async.py +0 -28
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_override_async.py +0 -106
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_usage_async.py +0 -38
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_basic_async.py +0 -76
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_lro_rpc_async.py +0 -22
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_lro_standard_async.py +0 -39
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_model_async.py +0 -33
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_page_async.py +0 -80
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_scalar_async.py +0 -41
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_core_traits_async.py +0 -87
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_encode_duration_async.py +0 -19
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_example_basic_async.py +0 -30
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_payload_pageable_async.py +0 -19
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_resource_manager_method_subscription_id_async.py +0 -248
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_resource_manager_multi_service_async.py +0 -110
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_resource_manager_multi_service_shared_models_async.py +0 -132
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_special_headers_client_request_id_async.py +0 -30
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_versioning_previewversion_async.py +0 -53
- package/generator/test/azure/mock_api_tests/asynctests/test_client_namespace_async.py +0 -34
- package/generator/test/azure/mock_api_tests/asynctests/test_client_naming_async.py +0 -69
- package/generator/test/azure/mock_api_tests/asynctests/test_client_naming_enum_conflict_async.py +0 -37
- package/generator/test/azure/mock_api_tests/asynctests/test_client_overload_async.py +0 -27
- package/generator/test/azure/mock_api_tests/asynctests/test_client_structure_async.py +0 -64
- package/generator/test/azure/mock_api_tests/asynctests/test_client_structure_clientoperationgroup_async.py +0 -31
- package/generator/test/azure/mock_api_tests/asynctests/test_encode_duration_async.py +0 -63
- package/generator/test/azure/mock_api_tests/asynctests/test_encode_numeric_async.py +0 -35
- package/generator/test/azure/mock_api_tests/asynctests/test_parameters_basic_async.py +0 -24
- package/generator/test/azure/mock_api_tests/asynctests/test_parameters_spread_async.py +0 -76
- package/generator/test/azure/mock_api_tests/asynctests/test_payload_content_negotiation_async.py +0 -37
- package/generator/test/azure/mock_api_tests/asynctests/test_payload_multipart_async.py +0 -216
- package/generator/test/azure/mock_api_tests/asynctests/test_resiliency_srv_driven_async.py +0 -130
- package/generator/test/azure/mock_api_tests/asynctests/test_serialization_encoded_name_json_async.py +0 -24
- package/generator/test/azure/mock_api_tests/asynctests/test_service_multi_service_async.py +0 -31
- package/generator/test/azure/mock_api_tests/asynctests/test_special_words_async.py +0 -71
- package/generator/test/azure/mock_api_tests/conftest.py +0 -207
- package/generator/test/azure/mock_api_tests/data/image.jpg +0 -0
- package/generator/test/azure/mock_api_tests/data/image.png +0 -0
- package/generator/test/azure/mock_api_tests/test_azure_arm_commonproperties.py +0 -89
- package/generator/test/azure/mock_api_tests/test_azure_arm_largeheader.py +0 -27
- package/generator/test/azure/mock_api_tests/test_azure_arm_nonresource.py +0 -34
- package/generator/test/azure/mock_api_tests/test_azure_arm_operationtemplates.py +0 -180
- package/generator/test/azure/mock_api_tests/test_azure_arm_resource.py +0 -436
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_access.py +0 -92
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_api_version_header.py +0 -17
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_api_version_path.py +0 -17
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_api_version_query.py +0 -17
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_client_default_value.py +0 -42
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_client_initialization.py +0 -51
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_client_location.py +0 -70
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_deserialize_empty_string_as_null.py +0 -19
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_flatten.py +0 -104
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_hierrarchy_building.py +0 -45
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_next_link_verb.py +0 -27
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_override.py +0 -102
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_usage.py +0 -32
- package/generator/test/azure/mock_api_tests/test_azure_core_basic.py +0 -70
- package/generator/test/azure/mock_api_tests/test_azure_core_lro_rpc.py +0 -20
- package/generator/test/azure/mock_api_tests/test_azure_core_lro_standard.py +0 -32
- package/generator/test/azure/mock_api_tests/test_azure_core_model.py +0 -30
- package/generator/test/azure/mock_api_tests/test_azure_core_page.py +0 -71
- package/generator/test/azure/mock_api_tests/test_azure_core_scalar.py +0 -35
- package/generator/test/azure/mock_api_tests/test_azure_core_traits.py +0 -85
- package/generator/test/azure/mock_api_tests/test_azure_encode_duration.py +0 -18
- package/generator/test/azure/mock_api_tests/test_azure_example_basic.py +0 -29
- package/generator/test/azure/mock_api_tests/test_azure_payload_pageable.py +0 -18
- package/generator/test/azure/mock_api_tests/test_azure_resource_manager_method_subscription_id.py +0 -235
- package/generator/test/azure/mock_api_tests/test_azure_resource_manager_multi_service.py +0 -104
- package/generator/test/azure/mock_api_tests/test_azure_resource_manager_multi_service_shared_models.py +0 -128
- package/generator/test/azure/mock_api_tests/test_azure_special_headers_client_request_id.py +0 -29
- package/generator/test/azure/mock_api_tests/test_azure_versioning_previewversion.py +0 -50
- package/generator/test/azure/mock_api_tests/test_clear_output_folder.py +0 -23
- package/generator/test/azure/mock_api_tests/test_client_namespace.py +0 -32
- package/generator/test/azure/mock_api_tests/test_client_naming.py +0 -57
- package/generator/test/azure/mock_api_tests/test_client_naming_enum_conflict.py +0 -35
- package/generator/test/azure/mock_api_tests/test_client_overload.py +0 -25
- package/generator/test/azure/mock_api_tests/test_client_structure.py +0 -60
- package/generator/test/azure/mock_api_tests/test_client_structure_clientoperationgroup.py +0 -29
- package/generator/test/azure/mock_api_tests/test_encode_duration.py +0 -60
- package/generator/test/azure/mock_api_tests/test_encode_numeric.py +0 -31
- package/generator/test/azure/mock_api_tests/test_model_base_flatten_compatibility.py +0 -251
- package/generator/test/azure/mock_api_tests/test_parameters_basic.py +0 -22
- package/generator/test/azure/mock_api_tests/test_parameters_spread.py +0 -66
- package/generator/test/azure/mock_api_tests/test_payload_content_negotiation.py +0 -33
- package/generator/test/azure/mock_api_tests/test_payload_multipart.py +0 -198
- package/generator/test/azure/mock_api_tests/test_resiliency_srv_driven.py +0 -124
- package/generator/test/azure/mock_api_tests/test_serialization_encoded_name_json.py +0 -21
- package/generator/test/azure/mock_api_tests/test_service_multi_service.py +0 -29
- package/generator/test/azure/mock_api_tests/test_special_words.py +0 -63
- package/generator/test/azure/requirements.txt +0 -125
- package/generator/test/azure/tox.ini +0 -64
- package/generator/test/data/image.jpg +0 -0
- package/generator/test/data/image.png +0 -0
- package/generator/test/dev_requirements.txt +0 -8
- package/generator/test/generic_mock_api_tests/asynctests/test_authentication_async.py +0 -140
- package/generator/test/generic_mock_api_tests/asynctests/test_encode_array_async.py +0 -139
- package/generator/test/generic_mock_api_tests/asynctests/test_encode_bytes_async.py +0 -132
- package/generator/test/generic_mock_api_tests/asynctests/test_encode_datetime_async.py +0 -127
- package/generator/test/generic_mock_api_tests/asynctests/test_headasboolean_async.py +0 -35
- package/generator/test/generic_mock_api_tests/asynctests/test_parameters_body_optionality_async.py +0 -30
- package/generator/test/generic_mock_api_tests/asynctests/test_parameters_collection_format_async.py +0 -38
- package/generator/test/generic_mock_api_tests/asynctests/test_parameters_path_async.py +0 -24
- package/generator/test/generic_mock_api_tests/asynctests/test_parameters_query_async.py +0 -18
- package/generator/test/generic_mock_api_tests/asynctests/test_payload_json_merge_patch_async.py +0 -98
- package/generator/test/generic_mock_api_tests/asynctests/test_payload_media_type_async.py +0 -27
- package/generator/test/generic_mock_api_tests/asynctests/test_payload_pageable_async.py +0 -134
- package/generator/test/generic_mock_api_tests/asynctests/test_payload_xml_async.py +0 -150
- package/generator/test/generic_mock_api_tests/asynctests/test_response_status_code_range_async.py +0 -38
- package/generator/test/generic_mock_api_tests/asynctests/test_routes_async.py +0 -331
- package/generator/test/generic_mock_api_tests/asynctests/test_server_endpoint_not_defined_async.py +0 -18
- package/generator/test/generic_mock_api_tests/asynctests/test_server_path_multiple_async.py +0 -25
- package/generator/test/generic_mock_api_tests/asynctests/test_server_path_single_async.py +0 -18
- package/generator/test/generic_mock_api_tests/asynctests/test_server_versions_not_versioned_async.py +0 -28
- package/generator/test/generic_mock_api_tests/asynctests/test_server_versions_versioned_async.py +0 -34
- package/generator/test/generic_mock_api_tests/asynctests/test_special_headers_conditional_request_async.py +0 -38
- package/generator/test/generic_mock_api_tests/asynctests/test_special_headers_repeatability_async.py +0 -19
- package/generator/test/generic_mock_api_tests/asynctests/test_specs_documentation_async.py +0 -59
- package/generator/test/generic_mock_api_tests/asynctests/test_streaming_jsonl_async.py +0 -27
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_array_async.py +0 -127
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_dictionary_async.py +0 -98
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_enum_extensible_async.py +0 -25
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_enum_fixed_async.py +0 -27
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_file_async.py +0 -59
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_empty_async.py +0 -32
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_enum_discriminator_async.py +0 -70
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_nested_discriminator_async.py +0 -85
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_not_discriminated_async.py +0 -34
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_recursive_async.py +0 -34
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_inheritance_single_discriminator_async.py +0 -67
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_usage_async.py +0 -32
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_model_visibility_async.py +0 -47
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_property_additionalproperties_async.py +0 -353
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_property_nullable_async.py +0 -110
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_property_optional_async.py +0 -197
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_property_valuetypes_async.py +0 -315
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_scalar_async.py +0 -60
- package/generator/test/generic_mock_api_tests/asynctests/test_typetest_union_async.py +0 -90
- package/generator/test/generic_mock_api_tests/asynctests/test_versioning_added_async.py +0 -36
- package/generator/test/generic_mock_api_tests/asynctests/test_versioning_made_optional_async.py +0 -21
- package/generator/test/generic_mock_api_tests/asynctests/test_versioning_removed_async.py +0 -39
- package/generator/test/generic_mock_api_tests/asynctests/test_versioning_renamed_from_async.py +0 -29
- package/generator/test/generic_mock_api_tests/asynctests/test_versioning_return_type_changed_from_async.py +0 -18
- package/generator/test/generic_mock_api_tests/asynctests/test_versioning_type_changed_from_async.py +0 -22
- package/generator/test/generic_mock_api_tests/conftest.py +0 -75
- package/generator/test/generic_mock_api_tests/data/image.jpg +0 -0
- package/generator/test/generic_mock_api_tests/data/image.png +0 -0
- package/generator/test/generic_mock_api_tests/test_authentication.py +0 -130
- package/generator/test/generic_mock_api_tests/test_encode_array.py +0 -126
- package/generator/test/generic_mock_api_tests/test_encode_bytes.py +0 -128
- package/generator/test/generic_mock_api_tests/test_encode_datetime.py +0 -123
- package/generator/test/generic_mock_api_tests/test_headasboolean.py +0 -33
- package/generator/test/generic_mock_api_tests/test_parameters_body_optionality.py +0 -27
- package/generator/test/generic_mock_api_tests/test_parameters_collection_format.py +0 -33
- package/generator/test/generic_mock_api_tests/test_parameters_path.py +0 -22
- package/generator/test/generic_mock_api_tests/test_parameters_query.py +0 -17
- package/generator/test/generic_mock_api_tests/test_payload_json_merge_patch.py +0 -93
- package/generator/test/generic_mock_api_tests/test_payload_media_type.py +0 -25
- package/generator/test/generic_mock_api_tests/test_payload_pageable.py +0 -99
- package/generator/test/generic_mock_api_tests/test_payload_xml.py +0 -135
- package/generator/test/generic_mock_api_tests/test_response_status_code_range.py +0 -36
- package/generator/test/generic_mock_api_tests/test_routes.py +0 -285
- package/generator/test/generic_mock_api_tests/test_server_endpoint_not_defined.py +0 -17
- package/generator/test/generic_mock_api_tests/test_server_path_multiple.py +0 -21
- package/generator/test/generic_mock_api_tests/test_server_path_single.py +0 -17
- package/generator/test/generic_mock_api_tests/test_server_versions_not_versioned.py +0 -25
- package/generator/test/generic_mock_api_tests/test_server_versions_versioned.py +0 -30
- package/generator/test/generic_mock_api_tests/test_special_headers_conditional_request.py +0 -34
- package/generator/test/generic_mock_api_tests/test_special_headers_repeatability.py +0 -18
- package/generator/test/generic_mock_api_tests/test_specs_documentation.py +0 -51
- package/generator/test/generic_mock_api_tests/test_streaming_jsonl.py +0 -25
- package/generator/test/generic_mock_api_tests/test_typetest_array.py +0 -111
- package/generator/test/generic_mock_api_tests/test_typetest_dictionary.py +0 -86
- package/generator/test/generic_mock_api_tests/test_typetest_enum_extensible.py +0 -23
- package/generator/test/generic_mock_api_tests/test_typetest_enum_fixed.py +0 -25
- package/generator/test/generic_mock_api_tests/test_typetest_file.py +0 -52
- package/generator/test/generic_mock_api_tests/test_typetest_model_empty.py +0 -29
- package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_enum_discriminator.py +0 -58
- package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_nested_discriminator.py +0 -79
- package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_not_discriminated.py +0 -31
- package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_recursive.py +0 -32
- package/generator/test/generic_mock_api_tests/test_typetest_model_inheritance_single_discriminator.py +0 -60
- package/generator/test/generic_mock_api_tests/test_typetest_model_usage.py +0 -28
- package/generator/test/generic_mock_api_tests/test_typetest_model_visibility.py +0 -40
- package/generator/test/generic_mock_api_tests/test_typetest_property_additionalproperties.py +0 -314
- package/generator/test/generic_mock_api_tests/test_typetest_property_nullable.py +0 -102
- package/generator/test/generic_mock_api_tests/test_typetest_property_optional.py +0 -174
- package/generator/test/generic_mock_api_tests/test_typetest_property_valuetypes.py +0 -286
- package/generator/test/generic_mock_api_tests/test_typetest_scalar.py +0 -53
- package/generator/test/generic_mock_api_tests/test_typetest_union.py +0 -80
- package/generator/test/generic_mock_api_tests/test_typetest_union_discriminated.py +0 -290
- package/generator/test/generic_mock_api_tests/test_versioning_added.py +0 -33
- package/generator/test/generic_mock_api_tests/test_versioning_made_optional.py +0 -20
- package/generator/test/generic_mock_api_tests/test_versioning_removed.py +0 -37
- package/generator/test/generic_mock_api_tests/test_versioning_renamed_from.py +0 -27
- package/generator/test/generic_mock_api_tests/test_versioning_return_type_changed_from.py +0 -17
- package/generator/test/generic_mock_api_tests/test_versioning_type_changed_from.py +0 -21
- package/generator/test/unbranded/mock_api_tests/asynctests/test_auth_flow_async.py +0 -19
- package/generator/test/unbranded/mock_api_tests/asynctests/test_encode_duration_async.py +0 -63
- package/generator/test/unbranded/mock_api_tests/asynctests/test_encode_numeric_async.py +0 -35
- package/generator/test/unbranded/mock_api_tests/asynctests/test_parameters_basic_async.py +0 -24
- package/generator/test/unbranded/mock_api_tests/asynctests/test_parameters_spread_async.py +0 -76
- package/generator/test/unbranded/mock_api_tests/asynctests/test_payload_content_negotiation_async.py +0 -37
- package/generator/test/unbranded/mock_api_tests/asynctests/test_payload_multipart_async.py +0 -218
- package/generator/test/unbranded/mock_api_tests/asynctests/test_serialization_encoded_name_json_async.py +0 -24
- package/generator/test/unbranded/mock_api_tests/asynctests/test_special_words_async.py +0 -73
- package/generator/test/unbranded/mock_api_tests/asynctests/test_unbranded_async.py +0 -24
- package/generator/test/unbranded/mock_api_tests/conftest.py +0 -91
- package/generator/test/unbranded/mock_api_tests/data/image.jpg +0 -0
- package/generator/test/unbranded/mock_api_tests/data/image.png +0 -0
- package/generator/test/unbranded/mock_api_tests/test_auth_flow.py +0 -17
- package/generator/test/unbranded/mock_api_tests/test_encode_duration.py +0 -60
- package/generator/test/unbranded/mock_api_tests/test_encode_numeric.py +0 -32
- package/generator/test/unbranded/mock_api_tests/test_parameters_basic.py +0 -22
- package/generator/test/unbranded/mock_api_tests/test_parameters_spread.py +0 -66
- package/generator/test/unbranded/mock_api_tests/test_payload_content_negotiation.py +0 -33
- package/generator/test/unbranded/mock_api_tests/test_payload_multipart.py +0 -200
- package/generator/test/unbranded/mock_api_tests/test_serialization_encoded_name_json.py +0 -22
- package/generator/test/unbranded/mock_api_tests/test_special_words.py +0 -66
- package/generator/test/unbranded/mock_api_tests/test_unbranded.py +0 -65
- package/generator/test/unbranded/requirements.txt +0 -69
- package/generator/test/unbranded/tox.ini +0 -64
- package/generator/test/unittests/conftest.py +0 -15
- package/generator/test/unittests/requirements.txt +0 -3
- package/generator/test/unittests/test_enums.py +0 -89
- package/generator/test/unittests/test_model_base_serialization.py +0 -4906
- package/generator/test/unittests/test_model_base_xml_serialization.py +0 -1239
- package/generator/test/unittests/test_name_converter.py +0 -35
- package/generator/test/unittests/test_optional_return_type.py +0 -268
- package/generator/test/unittests/test_parameter_ordering.py +0 -104
- package/generator/test/unittests/test_sort_schema.py +0 -93
- package/generator/test/unittests/tox.ini +0 -5
- /package/eng/scripts/ci/{mypy.ini → config/mypy.ini} +0 -0
- /package/eng/scripts/ci/{pylintrc → config/pylintrc} +0 -0
- /package/eng/scripts/ci/{pyproject.toml → config/pyproject.toml} +0 -0
- /package/eng/scripts/ci/{pyrightconfig.json → config/pyrightconfig.json} +0 -0
|
@@ -1,50 +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 specs.azure.versioning.previewversion import PreviewVersionClient
|
|
8
|
-
from specs.azure.versioning.previewversion.models import UpdateWidgetColorRequest
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
@pytest.fixture
|
|
12
|
-
def client():
|
|
13
|
-
with PreviewVersionClient() as client:
|
|
14
|
-
yield client
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
@pytest.fixture
|
|
18
|
-
def stable_client():
|
|
19
|
-
with PreviewVersionClient(api_version="2024-06-01") as client:
|
|
20
|
-
yield client
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
def test_get_widget(client: PreviewVersionClient):
|
|
24
|
-
result = client.get_widget(id="widget-123")
|
|
25
|
-
assert result.id == "widget-123"
|
|
26
|
-
assert result.name == "Sample Widget"
|
|
27
|
-
assert result.color == "blue"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
def test_update_widget_color(client: PreviewVersionClient):
|
|
31
|
-
color_update = UpdateWidgetColorRequest(color="red")
|
|
32
|
-
result = client.update_widget_color(id="widget-123", color_update=color_update)
|
|
33
|
-
assert result.id == "widget-123"
|
|
34
|
-
assert result.name == "Sample Widget"
|
|
35
|
-
assert result.color == "red"
|
|
36
|
-
|
|
37
|
-
with pytest.raises(ValueError):
|
|
38
|
-
with PreviewVersionClient(api_version="2024-06-01") as stable_client:
|
|
39
|
-
stable_client.update_widget_color(id="widget-123", color_update=color_update)
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
def test_list_widgets(stable_client: PreviewVersionClient):
|
|
43
|
-
result = stable_client.list_widgets(name="test")
|
|
44
|
-
assert len(result.widgets) == 1
|
|
45
|
-
assert result.widgets[0].id == "widget-1"
|
|
46
|
-
assert result.widgets[0].name == "test"
|
|
47
|
-
|
|
48
|
-
with pytest.raises(ValueError):
|
|
49
|
-
with PreviewVersionClient(api_version="2024-06-01") as client:
|
|
50
|
-
client.list_widgets(name="test", color="test")
|
|
@@ -1,23 +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
|
-
from pathlib import Path
|
|
7
|
-
|
|
8
|
-
GENERATED_PATH = Path(__file__).parent.parent.resolve() / "generated"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def test_clear_output_folder():
|
|
12
|
-
folder = GENERATED_PATH / "authentication-api-key/authentication/apikey/_operations"
|
|
13
|
-
assert folder.exists(), "Operations folder should exist"
|
|
14
|
-
assert not (folder / "to_be_deleted.py").exists(), "File to_be_deleted.py should be deleted after regeneration"
|
|
15
|
-
|
|
16
|
-
if (GENERATED_PATH / "generation-subdir").exists():
|
|
17
|
-
assert (GENERATED_PATH / "generation-subdir/generated_tests").exists()
|
|
18
|
-
assert not (GENERATED_PATH / "generation-subdir/generated_tests/to_be_deleted.py").exists()
|
|
19
|
-
|
|
20
|
-
assert (GENERATED_PATH / "generation-subdir/generation/subdir/_generated").exists()
|
|
21
|
-
assert not (GENERATED_PATH / "generation-subdir/generation/subdir/_generated/to_be_deleted.py").exists()
|
|
22
|
-
|
|
23
|
-
assert (GENERATED_PATH / "generation-subdir/generation/subdir/to_be_kept.py").exists()
|
|
@@ -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 client.clientnamespace import ClientNamespaceFirstClient
|
|
8
|
-
from client.clientnamespace.first.models import FirstClientResult
|
|
9
|
-
|
|
10
|
-
from client.clientnamespace.second import ClientNamespaceSecondClient
|
|
11
|
-
from client.clientnamespace.second.models import SecondClientResult
|
|
12
|
-
from client.clientnamespace.second.sub.models import SecondClientEnumType
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
@pytest.fixture
|
|
16
|
-
def first_client():
|
|
17
|
-
with ClientNamespaceFirstClient() as client:
|
|
18
|
-
yield client
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
@pytest.fixture
|
|
22
|
-
def second_client():
|
|
23
|
-
with ClientNamespaceSecondClient() as client:
|
|
24
|
-
yield client
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def test_get_first(first_client: ClientNamespaceFirstClient):
|
|
28
|
-
assert first_client.get_first() == FirstClientResult(name="first")
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
def test_get_second(second_client: ClientNamespaceSecondClient):
|
|
32
|
-
assert second_client.get_second() == SecondClientResult(type=SecondClientEnumType.SECOND)
|
|
@@ -1,57 +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 client.naming.main import NamingClient, models
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
@pytest.fixture
|
|
11
|
-
def client():
|
|
12
|
-
with NamingClient() as client:
|
|
13
|
-
yield client
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
def test_client(client: NamingClient):
|
|
17
|
-
client.property.client(models.ClientNameModel(client_name=True))
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
def test_language(client: NamingClient):
|
|
21
|
-
client.property.language(models.LanguageClientNameModel(python_name=True))
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
def test_compatible_with_encoded_name(client: NamingClient):
|
|
25
|
-
client.property.compatible_with_encoded_name(models.ClientNameAndJsonEncodedNameModel(client_name=True))
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def test_operation(client: NamingClient):
|
|
29
|
-
client.client_name()
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
def test_parameter(client: NamingClient):
|
|
33
|
-
client.parameter(client_name="true")
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
def test_header_request(client: NamingClient):
|
|
37
|
-
client.header.request(client_name="true")
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
def test_header_response(client: NamingClient):
|
|
41
|
-
assert client.header.response(cls=lambda x, y, z: z)["default-name"] == "true"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
def test_model_client(client: NamingClient):
|
|
45
|
-
client.model_client.client(models.ClientModel(default_name=True))
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
def test_model_language(client: NamingClient):
|
|
49
|
-
client.model_client.language(models.PythonModel(default_name=True))
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
def test_union_enum_member_name(client: NamingClient):
|
|
53
|
-
client.union_enum.union_enum_member_name(models.ExtensibleEnum.CLIENT_ENUM_VALUE1)
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
def test_union_enum_name(client: NamingClient):
|
|
57
|
-
client.union_enum.union_enum_name(models.ClientExtensibleEnum.ENUM_VALUE1)
|
|
@@ -1,35 +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 client.naming.enumconflict import EnumConflictClient
|
|
8
|
-
from client.naming.enumconflict.firstnamespace import models as first_models
|
|
9
|
-
from client.naming.enumconflict.secondnamespace import models as second_models
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
@pytest.fixture
|
|
13
|
-
def client():
|
|
14
|
-
with EnumConflictClient() as client:
|
|
15
|
-
yield client
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def test_first_operations_first(client: EnumConflictClient):
|
|
19
|
-
"""Test enum with same name in different namespace - first namespace."""
|
|
20
|
-
body = first_models.FirstModel(status=first_models.Status.ACTIVE, name="test")
|
|
21
|
-
|
|
22
|
-
response = client.first_operations.first(body=body)
|
|
23
|
-
|
|
24
|
-
assert response.status == "active"
|
|
25
|
-
assert response.name == "test"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def test_second_operations_second(client: EnumConflictClient):
|
|
29
|
-
"""Test enum with same name in different namespace - second namespace."""
|
|
30
|
-
body = second_models.SecondModel(status=second_models.SecondStatus.RUNNING, description="test description")
|
|
31
|
-
|
|
32
|
-
response = client.second_operations.second(body=body)
|
|
33
|
-
|
|
34
|
-
assert response.status == "running"
|
|
35
|
-
assert response.description == "test description"
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import pytest
|
|
2
|
-
from client.overload import OverloadClient
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class TestClientOverload:
|
|
6
|
-
@pytest.fixture
|
|
7
|
-
def client(self):
|
|
8
|
-
return OverloadClient(endpoint="http://localhost:3000")
|
|
9
|
-
|
|
10
|
-
def test_list(self, client: OverloadClient):
|
|
11
|
-
result = client.list()
|
|
12
|
-
assert len(result) == 2
|
|
13
|
-
assert result[0]["id"] == "1"
|
|
14
|
-
assert result[0]["name"] == "foo"
|
|
15
|
-
assert result[0]["scope"] == "car"
|
|
16
|
-
assert result[1]["id"] == "2"
|
|
17
|
-
assert result[1]["name"] == "bar"
|
|
18
|
-
assert result[1]["scope"] == "bike"
|
|
19
|
-
|
|
20
|
-
def test_list_by_scope(self, client: OverloadClient):
|
|
21
|
-
result = client.list_by_scope("car")
|
|
22
|
-
assert len(result) == 1
|
|
23
|
-
assert result[0]["id"] == "1"
|
|
24
|
-
assert result[0]["name"] == "foo"
|
|
25
|
-
assert result[0]["scope"] == "car"
|
|
@@ -1,60 +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 client.structure.service.models import ClientType
|
|
8
|
-
from client.structure.service import ServiceClient
|
|
9
|
-
from client.structure.multiclient import ClientAClient, ClientBClient
|
|
10
|
-
from client.structure.renamedoperation import RenamedOperationClient
|
|
11
|
-
from client.structure.twooperationgroup import TwoOperationGroupClient
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def test_structure_default():
|
|
15
|
-
client = ServiceClient(endpoint="http://localhost:3000", client=ClientType.DEFAULT)
|
|
16
|
-
client.one()
|
|
17
|
-
client.two()
|
|
18
|
-
client.foo.three()
|
|
19
|
-
client.foo.four()
|
|
20
|
-
client.bar.five()
|
|
21
|
-
client.bar.six()
|
|
22
|
-
client.baz.foo.seven()
|
|
23
|
-
client.qux.eight()
|
|
24
|
-
client.qux.bar.nine()
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def test_structure_multiclient():
|
|
28
|
-
client_a = ClientAClient(endpoint="http://localhost:3000", client=ClientType.MULTI_CLIENT)
|
|
29
|
-
client_a.renamed_one()
|
|
30
|
-
client_a.renamed_three()
|
|
31
|
-
client_a.renamed_five()
|
|
32
|
-
|
|
33
|
-
client_b = ClientBClient(endpoint="http://localhost:3000", client=ClientType.MULTI_CLIENT)
|
|
34
|
-
client_b.renamed_two()
|
|
35
|
-
client_b.renamed_four()
|
|
36
|
-
client_b.renamed_six()
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
@pytest.mark.skip(reason="will reopen the cases after upgrade `@azure-tools/typespec-client-generator-core` to 0.67.0")
|
|
40
|
-
def test_structure_renamed_operation():
|
|
41
|
-
client = RenamedOperationClient(endpoint="http://localhost:3000", client=ClientType.RENAMED_OPERATION)
|
|
42
|
-
client.renamed_one()
|
|
43
|
-
client.renamed_three()
|
|
44
|
-
client.renamed_five()
|
|
45
|
-
|
|
46
|
-
client.renamed_two()
|
|
47
|
-
client.renamed_four()
|
|
48
|
-
client.renamed_six()
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
@pytest.mark.skip(reason="will reopen the cases after upgrade `@azure-tools/typespec-client-generator-core` to 0.67.0")
|
|
52
|
-
def test_structure_two_operation_group():
|
|
53
|
-
client = TwoOperationGroupClient(endpoint="http://localhost:3000", client=ClientType.TWO_OPERATION_GROUP)
|
|
54
|
-
client.one()
|
|
55
|
-
client.three()
|
|
56
|
-
client.four()
|
|
57
|
-
|
|
58
|
-
client.two()
|
|
59
|
-
client.five()
|
|
60
|
-
client.six()
|
|
@@ -1,29 +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 client.structure.clientoperationgroup.models import ClientType
|
|
8
|
-
from client.structure.clientoperationgroup import FirstClient, SecondClient
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
@pytest.mark.skip(reason="will reopen the cases after upgrade `@azure-tools/typespec-client-generator-core` to 0.67.0")
|
|
12
|
-
def test_first_client_operations():
|
|
13
|
-
client = FirstClient(endpoint="http://localhost:3000", client=ClientType.CLIENT_OPERATION_GROUP)
|
|
14
|
-
|
|
15
|
-
client.one()
|
|
16
|
-
|
|
17
|
-
client.two()
|
|
18
|
-
client.three()
|
|
19
|
-
|
|
20
|
-
client.four()
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
@pytest.mark.skip(reason="will reopen the cases after upgrade `@azure-tools/typespec-client-generator-core` to 0.67.0")
|
|
24
|
-
def test_second_client_operations():
|
|
25
|
-
client = SecondClient(endpoint="http://localhost:3000", client=ClientType.CLIENT_OPERATION_GROUP)
|
|
26
|
-
|
|
27
|
-
client.five()
|
|
28
|
-
|
|
29
|
-
client.six()
|
|
@@ -1,60 +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 datetime
|
|
7
|
-
|
|
8
|
-
import pytest
|
|
9
|
-
from encode.duration import DurationClient
|
|
10
|
-
from encode.duration.models import (
|
|
11
|
-
Int32SecondsDurationProperty,
|
|
12
|
-
ISO8601DurationProperty,
|
|
13
|
-
FloatSecondsDurationProperty,
|
|
14
|
-
DefaultDurationProperty,
|
|
15
|
-
FloatSecondsDurationArrayProperty,
|
|
16
|
-
)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
@pytest.fixture
|
|
20
|
-
def client():
|
|
21
|
-
with DurationClient() as client:
|
|
22
|
-
yield client
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
def test_query(client: DurationClient):
|
|
26
|
-
client.query.default(input=datetime.timedelta(days=40))
|
|
27
|
-
client.query.iso8601(input=datetime.timedelta(days=40))
|
|
28
|
-
client.query.int32_seconds(input=36)
|
|
29
|
-
client.query.int32_seconds_array(input=[36, 47])
|
|
30
|
-
client.query.float_seconds(input=35.625)
|
|
31
|
-
client.query.float64_seconds(input=35.625)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
def test_property(client: DurationClient):
|
|
35
|
-
result = client.property.default(DefaultDurationProperty(value=datetime.timedelta(days=40)))
|
|
36
|
-
assert result.value == datetime.timedelta(days=40)
|
|
37
|
-
result = client.property.default(DefaultDurationProperty(value="P40D"))
|
|
38
|
-
assert result.value == datetime.timedelta(days=40)
|
|
39
|
-
result = client.property.iso8601(ISO8601DurationProperty(value=datetime.timedelta(days=40)))
|
|
40
|
-
assert result.value == datetime.timedelta(days=40)
|
|
41
|
-
result = client.property.iso8601(ISO8601DurationProperty(value="P40D"))
|
|
42
|
-
assert result.value == datetime.timedelta(days=40)
|
|
43
|
-
result = client.property.int32_seconds(Int32SecondsDurationProperty(value=36))
|
|
44
|
-
assert result.value == 36
|
|
45
|
-
result = client.property.float_seconds(FloatSecondsDurationProperty(value=35.625))
|
|
46
|
-
assert abs(result.value - 35.625) < 0.0001
|
|
47
|
-
result = client.property.float64_seconds(FloatSecondsDurationProperty(value=35.625))
|
|
48
|
-
assert abs(result.value - 35.625) < 0.0001
|
|
49
|
-
result = client.property.float_seconds_array(FloatSecondsDurationArrayProperty(value=[35.625, 46.75]))
|
|
50
|
-
assert abs(result.value[0] - 35.625) < 0.0001
|
|
51
|
-
assert abs(result.value[1] - 46.75) < 0.0001
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
def test_header(client: DurationClient):
|
|
55
|
-
client.header.default(duration=datetime.timedelta(days=40))
|
|
56
|
-
client.header.iso8601(duration=datetime.timedelta(days=40))
|
|
57
|
-
client.header.iso8601_array(duration=[datetime.timedelta(days=40), datetime.timedelta(days=50)])
|
|
58
|
-
client.header.int32_seconds(duration=36)
|
|
59
|
-
client.header.float_seconds(duration=35.625)
|
|
60
|
-
client.header.float64_seconds(duration=35.625)
|
|
@@ -1,31 +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 encode.numeric import NumericClient, models
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
@pytest.fixture
|
|
11
|
-
def client():
|
|
12
|
-
with NumericClient() as client:
|
|
13
|
-
yield client
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
def test_safeint_as_string(client: NumericClient):
|
|
17
|
-
result = client.property.safeint_as_string(models.SafeintAsStringProperty(value=10000000000))
|
|
18
|
-
assert result.value == 10000000000
|
|
19
|
-
assert result["value"] == "10000000000"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def test_uint32_as_string_optional(client: NumericClient):
|
|
23
|
-
result = client.property.uint32_as_string_optional(models.Uint32AsStringProperty(value=1))
|
|
24
|
-
assert result.value == 1
|
|
25
|
-
assert result["value"] == "1"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def test_uint8_as_string_optional(client: NumericClient):
|
|
29
|
-
result = client.property.uint8_as_string(models.Uint32AsStringProperty(value=255))
|
|
30
|
-
assert result.value == 255
|
|
31
|
-
assert result["value"] == "255"
|
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
# ------------------------------------
|
|
2
|
-
# Copyright (c) Microsoft Corporation.
|
|
3
|
-
# Licensed under the MIT License.
|
|
4
|
-
# ------------------------------------
|
|
5
|
-
import datetime
|
|
6
|
-
from typing import (
|
|
7
|
-
Any,
|
|
8
|
-
Mapping,
|
|
9
|
-
Optional,
|
|
10
|
-
overload,
|
|
11
|
-
)
|
|
12
|
-
|
|
13
|
-
from specs.azure.clientgenerator.core.flattenproperty._utils.model_base import (
|
|
14
|
-
Model,
|
|
15
|
-
rest_field,
|
|
16
|
-
)
|
|
17
|
-
from azure.core.serialization import attribute_list
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
class ModelProperty(Model):
|
|
21
|
-
"""This is a test model."""
|
|
22
|
-
|
|
23
|
-
value: str = rest_field()
|
|
24
|
-
"""Required."""
|
|
25
|
-
|
|
26
|
-
@overload
|
|
27
|
-
def __init__(
|
|
28
|
-
self,
|
|
29
|
-
*,
|
|
30
|
-
value: str,
|
|
31
|
-
) -> None: ...
|
|
32
|
-
|
|
33
|
-
@overload
|
|
34
|
-
def __init__(self, mapping: Mapping[str, Any]) -> None:
|
|
35
|
-
"""
|
|
36
|
-
:param mapping: raw JSON to initialize the model.
|
|
37
|
-
:type mapping: Mapping[str, Any]
|
|
38
|
-
"""
|
|
39
|
-
|
|
40
|
-
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
|
41
|
-
super().__init__(*args, **kwargs)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
class ChildModel(Model):
|
|
45
|
-
"""This is the child model to be flattened.
|
|
46
|
-
|
|
47
|
-
:ivar description: Required.
|
|
48
|
-
:vartype description: str
|
|
49
|
-
:ivar age: Required.
|
|
50
|
-
:vartype age: int
|
|
51
|
-
"""
|
|
52
|
-
|
|
53
|
-
description: str = rest_field()
|
|
54
|
-
"""Required."""
|
|
55
|
-
age: int = rest_field()
|
|
56
|
-
"""Required."""
|
|
57
|
-
model_property: "ModelProperty" = rest_field(name="modelProperty")
|
|
58
|
-
"""Required."""
|
|
59
|
-
datetime_default: datetime.datetime = rest_field(name="datetimeDefault")
|
|
60
|
-
datetime_rfc3339: datetime.datetime = rest_field(name="datetimeRfc3339", format="rfc3339")
|
|
61
|
-
datetime_rfc7231: datetime.datetime = rest_field(name="datetimeRfc7231", format="rfc7231")
|
|
62
|
-
datetime_unix_timestamp: datetime.datetime = rest_field(name="datetimeUnixTimestamp", format="unix-timestamp")
|
|
63
|
-
|
|
64
|
-
@overload
|
|
65
|
-
def __init__(
|
|
66
|
-
self,
|
|
67
|
-
*,
|
|
68
|
-
description: str,
|
|
69
|
-
age: int,
|
|
70
|
-
model_property: "ModelProperty",
|
|
71
|
-
datetime_default: datetime.datetime,
|
|
72
|
-
datetime_rfc3339: datetime.datetime,
|
|
73
|
-
datetime_rfc7231: datetime.datetime,
|
|
74
|
-
datetime_unix_timestamp: datetime.datetime,
|
|
75
|
-
) -> None: ...
|
|
76
|
-
|
|
77
|
-
@overload
|
|
78
|
-
def __init__(self, mapping: Mapping[str, Any]) -> None:
|
|
79
|
-
"""
|
|
80
|
-
:param mapping: raw JSON to initialize the model.
|
|
81
|
-
:type mapping: Mapping[str, Any]
|
|
82
|
-
"""
|
|
83
|
-
|
|
84
|
-
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
|
85
|
-
super().__init__(*args, **kwargs)
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
class FlattenModel(Model):
|
|
89
|
-
"""This is the model with one level of flattening."""
|
|
90
|
-
|
|
91
|
-
name: str = rest_field()
|
|
92
|
-
"""Required."""
|
|
93
|
-
properties: "ChildModel" = rest_field()
|
|
94
|
-
"""Required."""
|
|
95
|
-
|
|
96
|
-
__flattened_items = [
|
|
97
|
-
"description",
|
|
98
|
-
"age",
|
|
99
|
-
"model_property",
|
|
100
|
-
"datetime_default",
|
|
101
|
-
"datetime_rfc3339",
|
|
102
|
-
"datetime_rfc7231",
|
|
103
|
-
"datetime_unix_timestamp",
|
|
104
|
-
]
|
|
105
|
-
|
|
106
|
-
@overload
|
|
107
|
-
def __init__(
|
|
108
|
-
self,
|
|
109
|
-
*,
|
|
110
|
-
name: str,
|
|
111
|
-
properties: "ChildModel",
|
|
112
|
-
) -> None: ...
|
|
113
|
-
|
|
114
|
-
@overload
|
|
115
|
-
def __init__(self, mapping: Mapping[str, Any]) -> None:
|
|
116
|
-
"""
|
|
117
|
-
:param mapping: raw JSON to initialize the model.
|
|
118
|
-
:type mapping: Mapping[str, Any]
|
|
119
|
-
"""
|
|
120
|
-
|
|
121
|
-
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
|
122
|
-
_flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items}
|
|
123
|
-
super().__init__(*args, **kwargs)
|
|
124
|
-
for k, v in _flattened_input.items():
|
|
125
|
-
setattr(self, k, v)
|
|
126
|
-
|
|
127
|
-
def __getattr__(self, name: str) -> Any:
|
|
128
|
-
if name in self.__flattened_items:
|
|
129
|
-
if self.properties is None:
|
|
130
|
-
return None
|
|
131
|
-
return getattr(self.properties, name)
|
|
132
|
-
raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'")
|
|
133
|
-
|
|
134
|
-
def __setattr__(self, key: str, value: Any) -> None:
|
|
135
|
-
if key in self.__flattened_items:
|
|
136
|
-
if self.properties is None:
|
|
137
|
-
self.properties = self._attr_to_rest_field["properties"]._class_type()
|
|
138
|
-
setattr(self.properties, key, value)
|
|
139
|
-
else:
|
|
140
|
-
super().__setattr__(key, value)
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
def test_model_initialization():
|
|
144
|
-
model = FlattenModel(
|
|
145
|
-
name="test",
|
|
146
|
-
description="a description",
|
|
147
|
-
age=30,
|
|
148
|
-
model_property=ModelProperty(value="test value"),
|
|
149
|
-
datetime_default=datetime.datetime(2023, 1, 12, 0, 0, 0, tzinfo=datetime.timezone.utc),
|
|
150
|
-
datetime_rfc3339=datetime.datetime(2023, 1, 12, 0, 0, 0, tzinfo=datetime.timezone.utc),
|
|
151
|
-
datetime_rfc7231=datetime.datetime(2023, 1, 12, 0, 0, 0, tzinfo=datetime.timezone.utc),
|
|
152
|
-
datetime_unix_timestamp=datetime.datetime(2023, 1, 12, 0, 0, 0, tzinfo=datetime.timezone.utc),
|
|
153
|
-
)
|
|
154
|
-
|
|
155
|
-
assert model.name == "test"
|
|
156
|
-
|
|
157
|
-
assert model.description == "a description"
|
|
158
|
-
assert model.properties.description == "a description"
|
|
159
|
-
|
|
160
|
-
assert model.age == 30
|
|
161
|
-
assert model.properties.age == 30
|
|
162
|
-
|
|
163
|
-
assert model.model_property.value == "test value"
|
|
164
|
-
assert model.properties.model_property == ModelProperty(value="test value")
|
|
165
|
-
assert model.properties.model_property.value == "test value"
|
|
166
|
-
|
|
167
|
-
assert model.datetime_default == datetime.datetime(2023, 1, 12, 0, 0, 0, tzinfo=datetime.timezone.utc)
|
|
168
|
-
assert model.properties.datetime_default == datetime.datetime(2023, 1, 12, 0, 0, 0, tzinfo=datetime.timezone.utc)
|
|
169
|
-
assert model.properties["datetimeDefault"] == "2023-01-12T00:00:00Z"
|
|
170
|
-
|
|
171
|
-
assert model.datetime_rfc3339 == datetime.datetime(2023, 1, 12, 0, 0, 0, tzinfo=datetime.timezone.utc)
|
|
172
|
-
assert model.properties.datetime_rfc3339 == datetime.datetime(2023, 1, 12, 0, 0, 0, tzinfo=datetime.timezone.utc)
|
|
173
|
-
assert model.properties["datetimeRfc3339"] == "2023-01-12T00:00:00Z"
|
|
174
|
-
|
|
175
|
-
assert model.datetime_rfc7231 == datetime.datetime(2023, 1, 12, 0, 0, 0, tzinfo=datetime.timezone.utc)
|
|
176
|
-
assert model.properties.datetime_rfc7231 == datetime.datetime(2023, 1, 12, 0, 0, 0, tzinfo=datetime.timezone.utc)
|
|
177
|
-
assert model.properties["datetimeRfc7231"] == "Thu, 12 Jan 2023 00:00:00 GMT"
|
|
178
|
-
|
|
179
|
-
assert model.datetime_unix_timestamp == datetime.datetime(2023, 1, 12, 0, 0, 0, tzinfo=datetime.timezone.utc)
|
|
180
|
-
assert model.properties.datetime_unix_timestamp == datetime.datetime(
|
|
181
|
-
2023, 1, 12, 0, 0, 0, tzinfo=datetime.timezone.utc
|
|
182
|
-
)
|
|
183
|
-
assert model.properties["datetimeUnixTimestamp"] == 1673481600
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
class FlattenModelWithOptionalProperties(Model):
|
|
187
|
-
"""This is the model with one level of flattening and optional properties."""
|
|
188
|
-
|
|
189
|
-
name: str = rest_field()
|
|
190
|
-
"""Required."""
|
|
191
|
-
properties: Optional["ModelProperty"] = rest_field()
|
|
192
|
-
"""Optional."""
|
|
193
|
-
|
|
194
|
-
__flattened_items = ["value"]
|
|
195
|
-
|
|
196
|
-
@overload
|
|
197
|
-
def __init__(
|
|
198
|
-
self,
|
|
199
|
-
*,
|
|
200
|
-
name: str,
|
|
201
|
-
properties: Optional["ModelProperty"],
|
|
202
|
-
) -> None: ...
|
|
203
|
-
|
|
204
|
-
@overload
|
|
205
|
-
def __init__(self, mapping: Mapping[str, Any]) -> None:
|
|
206
|
-
"""
|
|
207
|
-
:param mapping: raw JSON to initialize the model.
|
|
208
|
-
:type mapping: Mapping[str, Any]
|
|
209
|
-
"""
|
|
210
|
-
|
|
211
|
-
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
|
212
|
-
_flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items}
|
|
213
|
-
super().__init__(*args, **kwargs)
|
|
214
|
-
for k, v in _flattened_input.items():
|
|
215
|
-
setattr(self, k, v)
|
|
216
|
-
|
|
217
|
-
def __getattr__(self, name: str) -> Any:
|
|
218
|
-
if name in self.__flattened_items:
|
|
219
|
-
if self.properties is None:
|
|
220
|
-
return None
|
|
221
|
-
return getattr(self.properties, name)
|
|
222
|
-
raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'")
|
|
223
|
-
|
|
224
|
-
def __setattr__(self, key: str, value: Any) -> None:
|
|
225
|
-
if key in self.__flattened_items:
|
|
226
|
-
if self.properties is None:
|
|
227
|
-
self.properties = self._attr_to_rest_field["properties"]._class_type()
|
|
228
|
-
setattr(self.properties, key, value)
|
|
229
|
-
else:
|
|
230
|
-
super().__setattr__(key, value)
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
def test_model_with_optional_properties_initialization():
|
|
234
|
-
model = FlattenModelWithOptionalProperties(
|
|
235
|
-
name="test",
|
|
236
|
-
value="test value",
|
|
237
|
-
)
|
|
238
|
-
|
|
239
|
-
assert model.name == "test"
|
|
240
|
-
|
|
241
|
-
assert model.value == "test value"
|
|
242
|
-
assert model.properties.value == "test value"
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
def test_model_with_optional_properties_attribute_list():
|
|
246
|
-
model = FlattenModelWithOptionalProperties(
|
|
247
|
-
name="test",
|
|
248
|
-
)
|
|
249
|
-
|
|
250
|
-
attrs = attribute_list(model)
|
|
251
|
-
assert sorted(attrs) == sorted(["name", "value"])
|
|
@@ -1,22 +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 parameters.basic import BasicClient
|
|
8
|
-
from parameters.basic.models import User
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
@pytest.fixture
|
|
12
|
-
def client():
|
|
13
|
-
with BasicClient() as client:
|
|
14
|
-
yield client
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
def test_explicit_simple(client: BasicClient):
|
|
18
|
-
client.explicit_body.simple(User(name="foo"))
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def test_implicit_simple(client: BasicClient):
|
|
22
|
-
client.implicit_body.simple(name="foo")
|