From f4f2afeb457429f55d6325ed557f8e92a74ee028 Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Tue, 19 Apr 2022 08:24:24 +0200 Subject: Refs #32226 -- Fixed JSON format of QuerySet.explain() on PostgreSQL when format is uppercased. Follow up to aba9c2de669dcc0278c7ffde7981be91801be00b. --- tests/queries/test_explain.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tests') 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: -- cgit v1.3