mirror of https://github.com/tiangolo/fastapi.git
🎨 [pre-commit.ci] Auto format from pre-commit.com hooks
This commit is contained in:
parent
3f5ad3689c
commit
5a38a03bf8
|
|
@ -144,7 +144,6 @@ class UploadFile(StarletteUploadFile):
|
||||||
Doc("The text encoding to use when decoding bytes. Defaults to 'utf-8'."),
|
Doc("The text encoding to use when decoding bytes. Defaults to 'utf-8'."),
|
||||||
] = "utf-8",
|
] = "utf-8",
|
||||||
) -> str:
|
) -> str:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Read the entire file as a text string.
|
Read the entire file as a text string.
|
||||||
This is a convenience wrapper around `await self.read()`
|
This is a convenience wrapper around `await self.read()`
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,6 @@ async def test_upload_file():
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_uploadfile_read_text(tmp_path):
|
async def test_uploadfile_read_text(tmp_path):
|
||||||
|
|
||||||
file_path = tmp_path / "sample.txt"
|
file_path = tmp_path / "sample.txt"
|
||||||
file_path.write_text("Hello FastAPI!")
|
file_path.write_text("Hello FastAPI!")
|
||||||
|
|
||||||
|
|
@ -82,4 +81,6 @@ async def test_uploadfile_read_text(tmp_path):
|
||||||
upload = UploadFile(filename="sample.txt", file=f)
|
upload = UploadFile(filename="sample.txt", file=f)
|
||||||
content = await upload.read_text()
|
content = await upload.read_text()
|
||||||
assert content == "Hello FastAPI!"
|
assert content == "Hello FastAPI!"
|
||||||
assert upload.filename == "sample.txt" # make sure .read_text() doesn't modify filename or headers
|
assert (
|
||||||
|
upload.filename == "sample.txt"
|
||||||
|
) # make sure .read_text() doesn't modify filename or headers
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue