diff options
author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-02-26 07:52:16 +0100 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-03-23 08:28:47 +0100 |
commit | 71ec102b01fcc85acae3819426a4e02ef423b0fa (patch) | |
tree | 4bea91872f6ecf85f4deb2512e7d11f01d9803b0 /tests/model_fields | |
parent | c4df8b86c7fac52d95eda3440edc397fc13c3e56 (diff) | |
download | django-71ec102b01fcc85acae3819426a4e02ef423b0fa.tar.gz |
Fixed #32483 -- Fixed QuerySet.values()/values_list() on JSONField key transforms with booleans on SQLite.
Thanks Matthew Cornell for the report.
Diffstat (limited to 'tests/model_fields')
-rw-r--r-- | tests/model_fields/test_jsonfield.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/model_fields/test_jsonfield.py b/tests/model_fields/test_jsonfield.py index c903074e70..f7721aa6e8 100644 --- a/tests/model_fields/test_jsonfield.py +++ b/tests/model_fields/test_jsonfield.py @@ -808,6 +808,16 @@ class TestQuerying(TestCase): with self.subTest(lookup=lookup): self.assertEqual(qs.values_list(lookup, flat=True).get(), expected) + def test_key_values_boolean(self): + qs = NullableJSONModel.objects.filter(value__h=True, value__i=False) + tests = [ + ('value__h', True), + ('value__i', False), + ] + for lookup, expected in tests: + with self.subTest(lookup=lookup): + self.assertIs(qs.values_list(lookup, flat=True).get(), expected) + @skipUnlessDBFeature('supports_json_field_contains') def test_key_contains(self): self.assertIs(NullableJSONModel.objects.filter(value__foo__contains='ar').exists(), False) |