(use_async: bool)
| 189 | @parametrize |
| 190 | @pytest.mark.asyncio |
| 191 | async def test_iso8601_format(use_async: bool) -> None: |
| 192 | dt = datetime.fromisoformat("2023-02-23T14:16:36.337692+00:00") |
| 193 | tz = "+00:00" if PYDANTIC_V1 else "Z" |
| 194 | assert await transform({"foo": dt}, DatetimeDict, use_async) == {"foo": "2023-02-23T14:16:36.337692+00:00"} # type: ignore[comparison-overlap] |
| 195 | assert await transform(DatetimeModel(foo=dt), Any, use_async) == {"foo": "2023-02-23T14:16:36.337692" + tz} # type: ignore[comparison-overlap] |
| 196 | |
| 197 | dt = dt.replace(tzinfo=None) |
| 198 | assert await transform({"foo": dt}, DatetimeDict, use_async) == {"foo": "2023-02-23T14:16:36.337692"} # type: ignore[comparison-overlap] |
| 199 | assert await transform(DatetimeModel(foo=dt), Any, use_async) == {"foo": "2023-02-23T14:16:36.337692"} # type: ignore[comparison-overlap] |
| 200 | |
| 201 | assert await transform({"foo": None}, DateDict, use_async) == {"foo": None} # type: ignore[comparison-overlap] |
| 202 | assert await transform(DateModel(foo=None), Any, use_async) == {"foo": None} # type: ignore |
| 203 | assert await transform({"foo": date.fromisoformat("2023-02-23")}, DateDict, use_async) == {"foo": "2023-02-23"} # type: ignore[comparison-overlap] |
| 204 | assert await transform(DateModel(foo=date.fromisoformat("2023-02-23")), DateDict, use_async) == { |
| 205 | "foo": "2023-02-23" |
| 206 | } # type: ignore[comparison-overlap] |
| 207 | |
| 208 | |
| 209 | @parametrize |
nothing calls this directly
no test coverage detected