(sync: bool)
| 343 | |
| 344 | @pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) |
| 345 | async def test_serialize_data(sync: bool) -> None: |
| 346 | def body() -> object: |
| 347 | return { |
| 348 | "nested": MappingProxyType({"keep": (1, 2), "drop": omit}), |
| 349 | "when": datetime(2024, 1, 2, 3, 4, 5, tzinfo=timezone.utc), |
| 350 | } |
| 351 | |
| 352 | if sync: |
| 353 | serialized = serialize_data(body(), location="body") |
| 354 | assert serialized == openapi_dumps_str(prepare_request_data(body(), location="body")) |
| 355 | else: |
| 356 | serialized = await async_serialize_data(body(), location="body") |
| 357 | assert serialized == openapi_dumps_str(await async_prepare_request_data(body(), location="body")) |
| 358 | assert serialized == '{"nested":{"keep":[1,2]},"when":"2024-01-02T03:04:05+00:00"}' |
| 359 | |
| 360 | |
| 361 | @pytest.mark.parametrize( |
nothing calls this directly
no test coverage detected