From aba9c2de669dcc0278c7ffde7981be91801be00b Mon Sep 17 00:00:00 2001 From: Wu Haotian Date: Wed, 30 Jun 2021 18:45:10 +0800 Subject: Fixed #32226 -- Fixed JSON format of QuerySet.explain() on PostgreSQL. --- tests/queries/test_explain.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests') 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): -- cgit v1.3