From 3187602f65593d431dcba40d546d52757b669b55 Mon Sep 17 00:00:00 2001 From: WrldEngine Date: Fri, 20 Jun 2025 14:37:52 +0500 Subject: [PATCH] hotfix: tests for python 3.8 --- tests/test_bsonjs_response_class.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/test_bsonjs_response_class.py b/tests/test_bsonjs_response_class.py index 1a577fc8a..2e853f904 100644 --- a/tests/test_bsonjs_response_class.py +++ b/tests/test_bsonjs_response_class.py @@ -1,6 +1,11 @@ import json -import bsonjs +# Because of python 3.8 doesn't support this library +try: + import bsonjs # type: ignore +except ImportError: # pragma: nocover + bsonjs = None + from fastapi import FastAPI from fastapi.responses import BSONJSResponse from fastapi.testclient import TestClient @@ -20,4 +25,9 @@ def test_bsonjs_serialized_data(): with client: response = client.get("/bsonjs_keys") - assert response.content == bsonjs.loads(json.dumps({"key": "Hello World", 1: 1})) + if bsonjs is not None: + assert response.content == bsonjs.loads( + json.dumps({"key": "Hello World", 1: 1}) + ) + + assert True