Browse Source

hotfix: tests for python 3.8

pull/13760/head
WrldEngine 4 weeks ago
parent
commit
3187602f65
  1. 14
      tests/test_bsonjs_response_class.py

14
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

Loading…
Cancel
Save