From 9bf5c8fdf81ddcd1fdd8024241bb259b8f1afabc Mon Sep 17 00:00:00 2001 From: Laurent LAPORTE Date: Wed, 6 Sep 2023 14:20:34 +0200 Subject: [PATCH] test: simplify unit tests for starlette >= 0.24 --- tests/matrixstore/test_service.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/tests/matrixstore/test_service.py b/tests/matrixstore/test_service.py index a251cda4c5..bbd37098b7 100644 --- a/tests/matrixstore/test_service.py +++ b/tests/matrixstore/test_service.py @@ -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():