Test passing file/stream into the UploadFile constructor
()
| 371 | |
| 372 | @pytest.mark.anyio |
| 373 | async def test_upload_file_file_input() -> None: |
| 374 | """Test passing file/stream into the UploadFile constructor""" |
| 375 | stream = io.BytesIO(b"data") |
| 376 | file = UploadFile(filename="file", file=stream, size=4) |
| 377 | assert await file.read() == b"data" |
| 378 | assert file.size == 4 |
| 379 | await file.write(b" and more data!") |
| 380 | assert await file.read() == b"" |
| 381 | assert file.size == 19 |
| 382 | await file.seek(0) |
| 383 | assert await file.read() == b"data and more data!" |
| 384 | |
| 385 | |
| 386 | @pytest.mark.anyio |
nothing calls this directly
no test coverage detected