summaryrefslogtreecommitdiff
path: root/tests/queries
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2022-04-19 08:24:24 +0200
committerGitHub <noreply@github.com>2022-04-19 08:24:24 +0200
commitf4f2afeb457429f55d6325ed557f8e92a74ee028 (patch)
tree266fcd7150fa098feddffcb85a53eaf9431fbf41 /tests/queries
parent903702dfb1461cbb4ab93f841651e6882a72d337 (diff)
downloaddjango-f4f2afeb457429f55d6325ed557f8e92a74ee028.tar.gz
Refs #32226 -- Fixed JSON format of QuerySet.explain() on PostgreSQL when format is uppercased.
Follow up to aba9c2de669dcc0278c7ffde7981be91801be00b.
Diffstat (limited to 'tests/queries')
-rw-r--r--tests/queries/test_explain.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/queries/test_explain.py b/tests/queries/test_explain.py
index 43ff0bdef3..7932eb14f2 100644
--- a/tests/queries/test_explain.py
+++ b/tests/queries/test_explain.py
@@ -41,14 +41,16 @@ class ExplainTests(TestCase):
)
self.assertIsInstance(result, str)
self.assertTrue(result)
- if format == "xml":
+ if not format:
+ continue
+ if format.lower() == "xml":
try:
xml.etree.ElementTree.fromstring(result)
except xml.etree.ElementTree.ParseError as e:
self.fail(
f"QuerySet.explain() result is not valid XML: {e}"
)
- elif format == "json":
+ elif format.lower() == "json":
try:
json.loads(result)
except json.JSONDecodeError as e: