MCPcopy Index your code
hub / github.com/fastapi/fastapi / test_upload_file

Function test_upload_file

tests/test_datastructures.py:56–66  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

54
55@pytest.mark.anyio
56async def test_upload_file():
57 stream = io.BytesIO(b"data")
58 file = UploadFile(filename="file", file=stream, size=4)
59 assert await file.read() == b"data"
60 assert file.size == 4
61 await file.write(b" and more data!")
62 assert await file.read() == b""
63 assert file.size == 19
64 await file.seek(0)
65 assert await file.read() == b"data and more data!"
66 await file.close()

Callers

nothing calls this directly

Calls 5

readMethod · 0.95
writeMethod · 0.95
seekMethod · 0.95
closeMethod · 0.95
UploadFileClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…