1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed #32226 -- Fixed JSON format of QuerySet.explain() on PostgreSQL.

This commit is contained in:
Wu Haotian
2021-06-30 18:45:10 +08:00
committed by Mariusz Felisiak
parent b3b04ad211
commit aba9c2de66
3 changed files with 12 additions and 1 deletions

View File

@@ -1,3 +1,4 @@
import json
import unittest
import xml.etree.ElementTree
@@ -39,6 +40,13 @@ class ExplainTests(TestCase):
self.fail(
f'QuerySet.explain() result is not valid XML: {e}'
)
elif format == 'json':
try:
json.loads(result)
except json.JSONDecodeError as e:
self.fail(
f'QuerySet.explain() result is not valid JSON: {e}'
)
@skipUnlessDBFeature('validates_explain_options')
def test_unknown_options(self):