Home / Function/ test_upload_file() — fastapi Function Reference

test_upload_file() — fastapi Function Reference

Architecture documentation for the test_upload_file() function in test_datastructures.py from the fastapi codebase.

Entity Profile

Dependency Diagram

graph TD
  2070de0b_f99d_ce4d_bb36_162d825290f1["test_upload_file()"]
  03dbbf97_8dc4_0b91_12c2_0804fcc355cf["test_datastructures.py"]
  2070de0b_f99d_ce4d_bb36_162d825290f1 -->|defined in| 03dbbf97_8dc4_0b91_12c2_0804fcc355cf
  1d8546f2_90ed_9120_dbc5_d713e7cf8085["read()"]
  2070de0b_f99d_ce4d_bb36_162d825290f1 -->|calls| 1d8546f2_90ed_9120_dbc5_d713e7cf8085
  bd22fc1b_4f68_64ff_378d_a081f71b63c3["write()"]
  2070de0b_f99d_ce4d_bb36_162d825290f1 -->|calls| bd22fc1b_4f68_64ff_378d_a081f71b63c3
  c591c04f_f53b_0c31_4022_096ff9bf737b["seek()"]
  2070de0b_f99d_ce4d_bb36_162d825290f1 -->|calls| c591c04f_f53b_0c31_4022_096ff9bf737b
  76af83fd_46f7_5935_efc3_87a0773b471d["close()"]
  2070de0b_f99d_ce4d_bb36_162d825290f1 -->|calls| 76af83fd_46f7_5935_efc3_87a0773b471d
  style 2070de0b_f99d_ce4d_bb36_162d825290f1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_datastructures.py lines 55–65

async def test_upload_file():
    stream = io.BytesIO(b"data")
    file = UploadFile(filename="file", file=stream, size=4)
    assert await file.read() == b"data"
    assert file.size == 4
    await file.write(b" and more data!")
    assert await file.read() == b""
    assert file.size == 19
    await file.seek(0)
    assert await file.read() == b"data and more data!"
    await file.close()

Domain

Subdomains

Frequently Asked Questions

What does test_upload_file() do?
test_upload_file() is a function in the fastapi codebase, defined in tests/test_datastructures.py.
Where is test_upload_file() defined?
test_upload_file() is defined in tests/test_datastructures.py at line 55.
What does test_upload_file() call?
test_upload_file() calls 4 function(s): close, read, seek, write.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free