From 41d82fda2a15b63bd27a6456be422c44bf43ab7b Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Fri, 22 Sep 2023 00:25:17 -0400 Subject: [PATCH] [5.0.x] Fixed JSONField's test_deep_distinct for DatabaseFeatures.nulls_order_largest=False. Failure observed on CockroachDB. Backport of b0788a0918d0e12bc8878581d99adc3a79799f94 from main --- tests/model_fields/test_jsonfield.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/model_fields/test_jsonfield.py b/tests/model_fields/test_jsonfield.py index 4a1cc075b4..63e06b99cb 100644 --- a/tests/model_fields/test_jsonfield.py +++ b/tests/model_fields/test_jsonfield.py @@ -725,7 +725,10 @@ class TestQuerying(TestCase): query = NullableJSONModel.objects.distinct("value__k__l").values_list( "value__k__l" ) - self.assertSequenceEqual(query, [("m",), (None,)]) + expected = [("m",), (None,)] + if not connection.features.nulls_order_largest: + expected.reverse() + self.assertSequenceEqual(query, expected) def test_isnull_key(self): # key__isnull=False works the same as has_key='key'.