(use_async: bool)
| 408 | @parametrize |
| 409 | @pytest.mark.asyncio |
| 410 | async def test_base64_file_input(use_async: bool) -> None: |
| 411 | # strings are left as-is |
| 412 | assert await transform({"foo": "bar"}, TypedDictBase64Input, use_async) == {"foo": "bar"} |
| 413 | |
| 414 | # pathlib.Path is automatically converted to base64 |
| 415 | assert await transform({"foo": SAMPLE_FILE_PATH}, TypedDictBase64Input, use_async) == { |
| 416 | "foo": "SGVsbG8sIHdvcmxkIQo=" |
| 417 | } # type: ignore[comparison-overlap] |
| 418 | |
| 419 | # io instances are automatically converted to base64 |
| 420 | assert await transform({"foo": io.StringIO("Hello, world!")}, TypedDictBase64Input, use_async) == { |
| 421 | "foo": "SGVsbG8sIHdvcmxkIQ==" |
| 422 | } # type: ignore[comparison-overlap] |
| 423 | assert await transform({"foo": io.BytesIO(b"Hello, world!")}, TypedDictBase64Input, use_async) == { |
| 424 | "foo": "SGVsbG8sIHdvcmxkIQ==" |
| 425 | } # type: ignore[comparison-overlap] |
nothing calls this directly
no test coverage detected