(cls)
| 336 | class TestQuerying(TestCase): |
| 337 | @classmethod |
| 338 | def setUpTestData(cls): |
| 339 | cls.primitives = [True, False, "yes", 7, 9.6] |
| 340 | values = [ |
| 341 | None, |
| 342 | [], |
| 343 | {}, |
| 344 | {"a": "b", "c": 14}, |
| 345 | { |
| 346 | "a": "b", |
| 347 | "c": 14, |
| 348 | "d": ["e", {"f": "g"}], |
| 349 | "h": True, |
| 350 | "i": False, |
| 351 | "j": None, |
| 352 | "k": {"l": "m"}, |
| 353 | "n": [None, True, False], |
| 354 | "o": '"quoted"', |
| 355 | "p": 4.2, |
| 356 | "r": {"s": True, "t": False}, |
| 357 | }, |
| 358 | [1, [2]], |
| 359 | {"k": True, "l": False, "foo": "bax"}, |
| 360 | { |
| 361 | "foo": "bar", |
| 362 | "baz": {"a": "b", "c": "d"}, |
| 363 | "bar": ["foo", "bar"], |
| 364 | "bax": {"foo": "bar"}, |
| 365 | }, |
| 366 | ] |
| 367 | objs = [NullableJSONModel(value=value) for value in values] |
| 368 | if connection.features.supports_primitives_in_json_field: |
| 369 | objs.extend([NullableJSONModel(value=value) for value in cls.primitives]) |
| 370 | objs = NullableJSONModel.objects.bulk_create(objs) |
| 371 | # Some backends don't return primary keys after bulk_create. |
| 372 | if any(obj.pk is None for obj in objs): |
| 373 | objs = list(NullableJSONModel.objects.order_by("id")) |
| 374 | cls.objs = objs |
| 375 | cls.raw_sql = "%s::jsonb" if connection.vendor == "postgresql" else "%s" |
| 376 | |
| 377 | def test_exact(self): |
| 378 | self.assertSequenceEqual( |
nothing calls this directly
no test coverage detected