- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 20 for file_sizes (0.05 sec)
-
tests/test_tutorial/test_request_files/test_tutorial003.py
("files", ("test.txt", file)), ("files", ("test2.txt", file2)), ), ) assert response.status_code == 200, response.text assert response.json() == {"file_sizes": [14, 15]} def test_post_upload_file(tmp_path, app: FastAPI): path = tmp_path / "test.txt" path.write_bytes(b"<file content>") path2 = tmp_path / "test2.txt" path2.write_bytes(b"<file content2>")Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 7.5K bytes - Viewed (0) -
tests/test_tutorial/test_request_files/test_tutorial002.py
("files", ("test.txt", file)), ("files", ("test2.txt", file2)), ), ) assert response.status_code == 200, response.text assert response.json() == {"file_sizes": [14, 15]} def test_post_upload_file(tmp_path, app: FastAPI): path = tmp_path / "test.txt" path.write_bytes(b"<file content>") path2 = tmp_path / "test2.txt" path2.write_bytes(b"<file content2>")Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 8.2K bytes - Viewed (0) -
tests/test_request_params/test_file/test_optional_list.py
async def read_optional_list_bytes(p: Annotated[Optional[list[bytes]], File()] = None): return {"file_size": [len(file) for file in p] if p else None} @app.post("/optional-list-uploadfile") async def read_optional_list_uploadfile( p: Annotated[Optional[list[UploadFile]], File()] = None, ): return {"file_size": [file.size for file in p] if p else None} @pytest.mark.parametrize( "path", [
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 10.4K bytes - Viewed (0) -
tests/test_request_params/test_file/test_optional.py
async def read_optional_bytes(p: Annotated[Optional[bytes], File()] = None): return {"file_size": len(p) if p else None} @app.post("/optional-uploadfile", operation_id="optional_uploadfile") async def read_optional_uploadfile(p: Annotated[Optional[UploadFile], File()] = None): return {"file_size": p.size if p else None} @pytest.mark.parametrize( "path", [ "/optional-bytes",
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 9.7K bytes - Viewed (0) -
tests/test_request_params/test_file/test_list.py
@app.post("/list-bytes", operation_id="list_bytes") async def read_list_bytes(p: Annotated[list[bytes], File()]): return {"file_size": [len(file) for file in p]} @app.post("/list-uploadfile", operation_id="list_uploadfile") async def read_list_uploadfile(p: Annotated[list[UploadFile], File()]): return {"file_size": [file.size for file in p]} @pytest.mark.parametrize( "path", [ "/list-bytes",
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:31:34 UTC 2025 - 11.2K bytes - Viewed (0) -
tests/test_request_params/test_file/test_required.py
@app.post("/required-bytes", operation_id="required_bytes") async def read_required_bytes(p: Annotated[bytes, File()]): return {"file_size": len(p)} @app.post("/required-uploadfile", operation_id="required_uploadfile") async def read_required_uploadfile(p: Annotated[UploadFile, File()]): return {"file_size": p.size} @pytest.mark.parametrize( "path", [ "/required-bytes", "/required-uploadfile",
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 10.8K bytes - Viewed (0) -
tests/test_tutorial/test_request_files/test_tutorial001.py
path.write_bytes(b"<file content>") with path.open("rb") as file: response = client.post("/files/", files={"file": file}) assert response.status_code == 200, response.text assert response.json() == {"file_size": 14} def test_post_large_file(tmp_path, client: TestClient): default_pydantic_max_size = 2**16 path = tmp_path / "test.txt" path.write_bytes(b"x" * (default_pydantic_max_size + 1))
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 7.1K bytes - Viewed (0) -
docs_src/request_forms_and_files/tutorial001_py39.py
from fastapi import FastAPI, File, Form, UploadFile app = FastAPI() @app.post("/files/") async def create_file( file: bytes = File(), fileb: UploadFile = File(), token: str = Form() ): return { "file_size": len(file), "token": token, "fileb_content_type": fileb.content_type,
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 317 bytes - Viewed (0) -
docs_src/request_files/tutorial001_py39.py
from fastapi import FastAPI, File, UploadFile app = FastAPI() @app.post("/files/") async def create_file(file: bytes = File()): return {"file_size": len(file)} @app.post("/uploadfile/") async def create_upload_file(file: UploadFile):
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 282 bytes - Viewed (0) -
docs_src/request_files/tutorial001_03_py39.py
from fastapi import FastAPI, File, UploadFile app = FastAPI() @app.post("/files/") async def create_file(file: bytes = File(description="A file read as bytes")): return {"file_size": len(file)} @app.post("/uploadfile/") async def create_upload_file( file: UploadFile = File(description="A file read as UploadFile"), ):
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 371 bytes - Viewed (0)