|
28 | 28 | import warnings |
29 | 29 | from pathlib import Path |
30 | 30 |
|
31 | | -from bson import ObjectId, encode |
| 31 | +from bson import ObjectId, encode, json_util |
32 | 32 | from django.test import ( |
33 | 33 | TestCase, |
34 | 34 | ) |
@@ -169,7 +169,7 @@ class SmallFlatDocTest(PerformanceTest): |
169 | 169 | def setUp(self): |
170 | 170 | super().setUp() |
171 | 171 | with open(Path(TEST_PATH) / Path("flat_models") / self.dataset) as data: # noqa: PTH123 |
172 | | - self.document = json.load(data) |
| 172 | + self.document = json_util.loads(data.read()) |
173 | 173 |
|
174 | 174 | self.data_size = len(encode(self.document)) * NUM_DOCS |
175 | 175 | self.documents = [self.document.copy() for _ in range(NUM_DOCS)] |
@@ -252,7 +252,7 @@ class LargeFlatDocTest(PerformanceTest): |
252 | 252 | def setUp(self): |
253 | 253 | super().setUp() |
254 | 254 | with open(Path(TEST_PATH) / Path("flat_models") / self.dataset) as data: # noqa: PTH123 |
255 | | - self.document = json.load(data) |
| 255 | + self.document = json_util.loads(data.read()) |
256 | 256 |
|
257 | 257 | self.data_size = len(encode(self.document)) * NUM_DOCS |
258 | 258 | self.documents = [self.document.copy() for _ in range(NUM_DOCS)] |
@@ -293,7 +293,7 @@ class LargeNestedDocTest(PerformanceTest): |
293 | 293 | def setUp(self): |
294 | 294 | super().setUp() |
295 | 295 | with open(Path(TEST_PATH) / Path("nested_models") / self.dataset) as data: # noqa: PTH123 |
296 | | - self.document = json.load(data) |
| 296 | + self.document = json_util.loads(data.read()) |
297 | 297 |
|
298 | 298 | self.data_size = len(encode(self.document)) * NUM_DOCS |
299 | 299 | self.documents = [self.document.copy() for _ in range(NUM_DOCS)] |
|
0 commit comments