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