summaryrefslogtreecommitdiff
path: root/tests/raw_query
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2019-11-15 16:20:07 -0500
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-11-18 14:06:51 +0100
commit11e327a3ff84e16ceace13ea6ec408a93ca9e72c (patch)
tree438e482ac75e6ae404920493a628eb00e7519e59 /tests/raw_query
parentcbe4d6203ff2d702b63dae52adbe7a50830a5cbe (diff)
downloaddjango-11e327a3ff84e16ceace13ea6ec408a93ca9e72c.tar.gz
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.
Diffstat (limited to 'tests/raw_query')
-rw-r--r--tests/raw_query/tests.py5
1 files changed, 3 insertions, 2 deletions
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):