Test passing file/stream into the UploadFile constructor
()
| 423 | |
| 424 | @pytest.mark.anyio |
| 425 | async def test_upload_file_file_input() -> None: |
| 426 | """Test passing file/stream into the UploadFile constructor""" |
| 427 | stream = io.BytesIO(b"data") |
| 428 | file = UploadFile(filename="file", file=stream, size=4) |
| 429 | assert await file.read() == b"data" |
| 430 | assert file.size == 4 |
| 431 | await file.write(b" and more data!") |
| 432 | assert await file.read() == b"" |
| 433 | assert file.size == 19 |
| 434 | await file.seek(0) |
| 435 | assert await file.read() == b"data and more data!" |
| 436 | |
| 437 | |
| 438 | @pytest.mark.anyio |
nothing calls this directly
no test coverage detected