Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: internal
packages:
- "@typespec/http-client-python"
---

Add sync and async mock_api tests for the single-discriminator no-subtypes Spector scenario from http-specs.
26 changes: 13 additions & 13 deletions packages/http-client-python/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/http-client-python/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
"@typespec/sse": "~0.82.0",
"@typespec/streams": "~0.82.0",
"@typespec/xml": "~0.82.0",
"@typespec/http-specs": "0.1.0-alpha.37",
"@typespec/http-specs": "0.1.0-alpha.38-dev.1",
"@types/js-yaml": "~4.0.5",
"@types/node": "~25.0.2",
"@types/semver": "7.5.8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pytest
import pytest_asyncio
from typetest.model.singlediscriminator.aio import SingleDiscriminatorClient
from typetest.model.singlediscriminator.models import Sparrow, Eagle, Bird, Dinosaur
from typetest.model.singlediscriminator.models import Sparrow, Eagle, Bird, Dinosaur, Fish


@pytest_asyncio.fixture
Expand Down Expand Up @@ -63,6 +63,16 @@ async def test_get_wrong_discriminator(client):
assert await client.get_wrong_discriminator() == Bird(wingspan=1, kind="wrongKind")


@pytest.mark.asyncio
async def test_get_no_subtypes_model(client):
assert await client.get_no_subtypes_model() == Fish(kind="salmon", size=10)


@pytest.mark.asyncio
async def test_put_no_subtypes_model(client):
await client.put_no_subtypes_model(Fish(kind="salmon", size=10))


@pytest.mark.asyncio
async def test_get_legacy_model(client):
assert await client.get_legacy_model() == Dinosaur(size=20, kind="t-rex")
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# --------------------------------------------------------------------------
import pytest
from typetest.model.singlediscriminator import SingleDiscriminatorClient
from typetest.model.singlediscriminator.models import Sparrow, Eagle, Bird, Dinosaur
from typetest.model.singlediscriminator.models import Sparrow, Eagle, Bird, Dinosaur, Fish


@pytest.fixture
Expand Down Expand Up @@ -56,5 +56,13 @@ def test_get_wrong_discriminator(client):
assert client.get_wrong_discriminator() == Bird(wingspan=1, kind="wrongKind")


def test_get_no_subtypes_model(client):
assert client.get_no_subtypes_model() == Fish(kind="salmon", size=10)


def test_put_no_subtypes_model(client):
client.put_no_subtypes_model(Fish(kind="salmon", size=10))


def test_get_legacy_model(client):
assert client.get_legacy_model() == Dinosaur(size=20, kind="t-rex")
Loading