Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 10, 2026

Adds Python test coverage for the XML model with enum property introduced in #9660.

Changes

  • Sync test (test_payload_xml.py): Tests GET/PUT operations for ModelWithEnum with Status enum
  • Async test (test_payload_xml_async.py): Async variant of the enum test
  • Changelog: Added internal change entry

Test Example

def test_model_with_enum(client: XmlClient):
    model = ModelWithEnum(status="success")
    assert client.model_with_enum_value.get() == model
    client.model_with_enum_value.put(model)

The tests validate serialization/deserialization of XML payloads containing extensible enum values ("pending", "success", "error").

Original prompt

This section details on the original issue you should resolve

<issue_title>[http-client-python] Add test case for XML model with enum</issue_title>
<issue_description>Add a test case to https://github.com/microsoft/typespec/blob/main/packages/http-client-python/generator/test/generic_mock_api_tests/test_payload_xml.py for #9660 which added a new test API for an XML payload with an enum.

Also add the equivalent async test to https://github.com/microsoft/typespec/blob/main/packages/http-client-python/generator/test/generic_mock_api_tests/asynctests/test_payload_xml_async.py

NOTE:

  • DO add changelog
  • DO format your changed files before commit</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 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.

Copilot AI and others added 2 commits February 10, 2026 00:58
Co-authored-by: annatisch <8689453+annatisch@users.noreply.github.com>
Co-authored-by: annatisch <8689453+annatisch@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service bot added lib:http-specs For issues/prs related to the @typespec/http-specs package emitter:client:python Issue for the Python client emitter: @typespec/http-client-python labels Feb 10, 2026
Copilot AI changed the title [WIP] Add test case for XML model with enum [http-client-python] Add test cases for XML model with enum property Feb 10, 2026
Copilot AI requested a review from annatisch February 10, 2026 01:03

@pytest.mark.asyncio
async def test_model_with_enum(client: XmlClient):
model = ModelWithEnum(status="success")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use the generated enum rather than the raw string, e.g. status=Status.SUCCESS



def test_model_with_enum(client: XmlClient):
model = ModelWithEnum(status="success")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use the generated enum rather than the raw string, e.g. status=Status.SUCCESS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:client:python Issue for the Python client emitter: @typespec/http-client-python lib:http-specs For issues/prs related to the @typespec/http-specs package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[http-client-python] Add test case for XML model with enum

2 participants