Skip to content

Commit

Permalink
Add coverage TypeAdapter in asend
Browse files Browse the repository at this point in the history
  • Loading branch information
foarsitter committed Nov 18, 2024
1 parent f7a6be2 commit e171c26
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/test_request_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import pytest
from fastapi._compat import field_annotation_is_scalar
from fastapi._compat import field_annotation_is_sequence
from httpx import AsyncClient
from pydantic import BaseModel
from pydantic import ValidationError
from typeguard import suppress_type_checks
Expand All @@ -19,6 +20,7 @@
from requestmodel import RequestModel
from requestmodel import params
from requestmodel.utils import get_annotated_type
from tests.fastapi_server import app
from tests.fastapi_server import client
from tests.fastapi_server.schema import NameModel
from tests.fastapi_server.schema import NameModelList
Expand Down Expand Up @@ -211,3 +213,15 @@ def test_type_adapter() -> None:
response = request.send(client)

assert response == [NameModel(name="test")]


@pytest.mark.asyncio
@suppress_type_checks
async def test_type_adapter_async() -> None:
request = TypeAdapterRequest()

async with AsyncClient(app=app, base_url="http://test") as client: # type: ignore

response = await request.asend(client)

assert response == [NameModel(name="test")]

0 comments on commit e171c26

Please sign in to comment.