diff --git a/.chronus/changes/python-alternate-type-test-2026-9-29-5-24-0.md b/.chronus/changes/python-alternate-type-test-2026-9-29-5-24-0.md new file mode 100644 index 00000000000..0a37fb768e2 --- /dev/null +++ b/.chronus/changes/python-alternate-type-test-2026-9-29-5-24-0.md @@ -0,0 +1,7 @@ +--- +changeKind: internal +packages: + - "@typespec/http-client-python" +--- + +Assert alternate-type responses are deserialized as `geojson.Feature` in sync and async mock API tests. diff --git a/packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_client_generator_core_alternate_type_async.py b/packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_client_generator_core_alternate_type_async.py index 30f453723e1..31f286792b5 100644 --- a/packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_client_generator_core_alternate_type_async.py +++ b/packages/http-client-python/tests/mock_api/azure/asynctests/test_azure_client_generator_core_alternate_type_async.py @@ -34,6 +34,7 @@ async def test_external_type_get_model(client: AlternateTypeClient): """Test getting a Feature object with geometry, properties, and optional id fields.""" result = await client.external_type.get_model() + assert isinstance(result, geojson.Feature) # Validate the response structure based on the TypeSpec example assert result.type == "Feature" assert result.geometry.type == "Point" @@ -55,6 +56,7 @@ async def test_external_type_get_property(client: AlternateTypeClient): """Test getting a ModelWithFeatureProperty object with feature and additionalProperty fields.""" result = await client.external_type.get_property() + assert isinstance(result.feature, geojson.Feature) # Validate the response structure based on the TypeSpec example assert result.feature.type == "Feature" assert result.feature.geometry.type == "Point" diff --git a/packages/http-client-python/tests/mock_api/azure/test_azure_client_generator_core_alternate_type.py b/packages/http-client-python/tests/mock_api/azure/test_azure_client_generator_core_alternate_type.py index c5ae3266c87..278333d1ceb 100644 --- a/packages/http-client-python/tests/mock_api/azure/test_azure_client_generator_core_alternate_type.py +++ b/packages/http-client-python/tests/mock_api/azure/test_azure_client_generator_core_alternate_type.py @@ -32,6 +32,7 @@ def test_external_type_get_model(client: AlternateTypeClient): """Test getting a Feature object with geometry, properties, and optional id fields.""" result = client.external_type.get_model() + assert isinstance(result, geojson.Feature) # Validate the response structure based on the TypeSpec example assert result.type == "Feature" assert result.geometry.type == "Point" @@ -51,6 +52,7 @@ def test_external_type_get_property(client: AlternateTypeClient): """Test getting a ModelWithFeatureProperty object with feature and additionalProperty fields.""" result = client.external_type.get_property() + assert isinstance(result.feature, geojson.Feature) # Validate the response structure based on the TypeSpec example assert result.feature.type == "Feature" assert result.feature.geometry.type == "Point"