summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorWu Haotian <whtsky@gmail.com>2021-06-30 18:45:10 +0800
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-07-05 09:08:39 +0200
commitaba9c2de669dcc0278c7ffde7981be91801be00b (patch)
treed0bad959ff2d904f2f5da16c155daf48ee7bc8cf /tests
parentb3b04ad2111f1e3eb0640cd5d51d4391655317ce (diff)
Fixed #32226 -- Fixed JSON format of QuerySet.explain() on PostgreSQL.
Diffstat (limited to 'tests')
-rw-r--r--tests/queries/test_explain.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/queries/test_explain.py b/tests/queries/test_explain.py
index 9bf7de687a..f1108c062f 100644
--- a/tests/queries/test_explain.py
+++ b/tests/queries/test_explain.py
@@ -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):