[http-client-python] Add test cases for XML models with enum and datetime properties#9663
[http-client-python] Add test cases for XML models with enum and datetime properties#9663
Conversation
Co-authored-by: annatisch <8689453+annatisch@users.noreply.github.com>
Co-authored-by: annatisch <8689453+annatisch@users.noreply.github.com>
...ttp-client-python/generator/test/generic_mock_api_tests/asynctests/test_payload_xml_async.py
Outdated
Show resolved
Hide resolved
packages/http-client-python/generator/test/generic_mock_api_tests/test_payload_xml.py
Outdated
Show resolved
Hide resolved
Co-authored-by: annatisch <8689453+annatisch@users.noreply.github.com>
|
@copilot - the test failures indicate that the generated Python models cannot be imported for the tests: Are you missing a code generation step? Or is there another reason the new XML models aren't generating? |
... I see the import error. The test is trying to import The TypeSpec changes (commit 4ae204d) added the
Could you share the full CI log? I want to check if:
Alternatively, if you can confirm the regenerate step ran successfully, there might be an issue with how the Python models are being generated from the extensible union ( |
|
@copilot here is the full CI log: |
I found the issue! The CI log shows that But the tests fail with: The problem is that the regeneration is reading from
The fix requires ensuring the locally-modified http-specs is available before regeneration. This might need changes to the CI workflow or build process to link the local packages properly. |
Co-authored-by: annatisch <8689453+annatisch@users.noreply.github.com>
Added test case for ModelWithDatetime in commit e47825f. The test includes both rfc3339 and rfc7231 datetime encodings as specified in PR #9660. Both sync and async test cases have been added following the same pattern as the enum test. |
commit: |
|
@copilot - the http specs for the new tests have been merged into main, however the tests are still failing with import errors. Please see the CI output here: https://dev.azure.com/azure-sdk/29ec6040-b234-4e31-b139-33dc4287b756/_apis/build/builds/5874349/logs/238 |
Co-authored-by: annatisch <8689453+annatisch@users.noreply.github.com>
Fixed the import errors in commit fad58ae. The issue was that http-client-python was using a fixed version ( |
|
@copilot - can you update the dependency to "0.1.0-alpha.33-dev.2" instead? |
Co-authored-by: annatisch <8689453+annatisch@users.noreply.github.com>
|
@copilot - there seems to be a version conflict. Here's the CI log: https://dev.azure.com/azure-sdk/29ec6040-b234-4e31-b139-33dc4287b756/_apis/build/builds/5874664/logs/101 |
Co-authored-by: annatisch <8689453+annatisch@users.noreply.github.com>
Fixed the version conflict in commit 7fd2355. Ran |
Add support for deserializers in _DESERIALIZE_MAPPING and handle ET.Element type.
|
Hi @annatisch, I write a skill to enable AI to add test case and here is the promp: And here is the created PR by AI: #9724. In the PR, AI tries to fix the bug for xml deserialization. China team is going to take leave for Chinese New Year so feel free to take over this PR. |
Plan: Add test cases for XML models with enum and datetime
Based on PR #9660 which added
ModelWithEnumwith aStatusenum andModelWithDatetimewith datetime properties to the XML payload spec, I added Python test cases.Tasks:
Summary:
Successfully added test cases for XML models with enum and datetime properties. The changes include:
ModelWithEnum,ModelWithDatetime,Status, anddatetimemodule to both sync and async test filestest_model_with_enumandtest_model_with_datetimeintest_payload_xml.pythat test GET and PUT operationstest_payload_xml_async.pythat mirror the sync tests with async/await@typespec/http-specsto version0.1.0-alpha.33-dev.2in both package.json and package-lock.json, which includes the merged PR Add XML model test cases for enum and datetime properties #9660 changes with the new modelsThe tests use:
Status.SUCCESSenum value instead of raw string "success", following the established pattern in other enum testsOriginal prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.