from __future__ import annotations from datetime import datetime, timezone from crawlee._utils.file import json_dumps async def test_json_dumps() -> None: assert await json_dumps({'key': 'value'}) == '{\n "key": "value"\n}' assert await json_dumps(['one', 2, 3.0]) == '[\n "one",\n 2,\n 3.0\n]' assert await json_dumps('string') == '"string"' assert await json_dumps(123) == '123' assert await json_dumps(datetime(2022, 1, 1, tzinfo=timezone.utc)) == '"2022-01-01 00:00:00+00:00"'