Browse Source

🎨 [pre-commit.ci] Auto format from pre-commit.com hooks

pull/14347/head
pre-commit-ci[bot] 8 months ago
parent
commit
5a38a03bf8
  1. 1
      fastapi/datastructures.py
  2. 5
      tests/test_datastructures.py

1
fastapi/datastructures.py

@ -144,7 +144,6 @@ class UploadFile(StarletteUploadFile):
Doc("The text encoding to use when decoding bytes. Defaults to 'utf-8'."),
] = "utf-8",
) -> str:
"""
Read the entire file as a text string.
This is a convenience wrapper around `await self.read()`

5
tests/test_datastructures.py

@ -74,7 +74,6 @@ async def test_upload_file():
@pytest.mark.asyncio
async def test_uploadfile_read_text(tmp_path):
file_path = tmp_path / "sample.txt"
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)
content = await upload.read_text()
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…
Cancel
Save