From 11e327a3ff84e16ceace13ea6ec408a93ca9e72c Mon Sep 17 00:00:00 2001 From: Simon Charette Date: Fri, 15 Nov 2019 16:20:07 -0500 Subject: Fixed #30988 -- Deprecated the InvalidQuery exception. It was barely documented without pointers at its defining location and was abused to prevent misuse of the QuerySet field deferring feature. --- tests/raw_query/tests.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tests/raw_query') diff --git a/tests/raw_query/tests.py b/tests/raw_query/tests.py index 703a6b311e..bc9ed47c81 100644 --- a/tests/raw_query/tests.py +++ b/tests/raw_query/tests.py @@ -1,8 +1,8 @@ from datetime import date from decimal import Decimal +from django.core.exceptions import FieldDoesNotExist from django.db.models.query import RawQuerySet -from django.db.models.query_utils import InvalidQuery from django.test import TestCase, skipUnlessDBFeature from .models import ( @@ -235,7 +235,8 @@ class RawQueryTests(TestCase): def test_missing_fields_without_PK(self): query = "SELECT first_name, dob FROM raw_query_author" - with self.assertRaisesMessage(InvalidQuery, 'Raw query must include the primary key'): + msg = 'Raw query must include the primary key' + with self.assertRaisesMessage(FieldDoesNotExist, msg): list(Author.objects.raw(query)) def test_annotations(self): -- cgit v1.3