Skip to content

Commit

Permalink
test: simplify unit tests for starlette >= 0.24
Browse files Browse the repository at this point in the history
  • Loading branch information
laurent-laporte-pro committed Sep 8, 2023
1 parent 6e7f881 commit 9bf5c8f
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions tests/matrixstore/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,14 +348,10 @@ def test_dataset_lifecycle():


def _create_upload_file(filename: str, file: t.IO = None, content_type: str = "") -> UploadFile:
if hasattr(UploadFile, "content_type"):
# `content_type` attribute was replace by a read-ony property in starlette-v0.24.
headers = Headers(headers={"content-type": content_type})
# noinspection PyTypeChecker,PyArgumentList
return UploadFile(filename=filename, file=file, headers=headers)
else:
# noinspection PyTypeChecker,PyArgumentList
return UploadFile(filename=filename, file=file, content_type=content_type)
# `content_type` attribute was replace by a read-ony property in starlette-v0.24.
headers = Headers(headers={"content-type": content_type})
# noinspection PyTypeChecker,PyArgumentList
return UploadFile(filename=filename, file=file, headers=headers)


def test_import():
Expand Down

0 comments on commit 9bf5c8f

Please sign in to comment.