summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorArtur Frysiak <artur@frysiak.net>2014-02-15 22:44:14 +0100
committerTim Graham <timograham@gmail.com>2014-02-17 14:46:13 -0500
commitfaf6a911ad7357c8dd1defa3be0317a8418febf7 (patch)
tree75ebbb6b93ea6d574185472bc1d7bf82df053a7e /tests
parenta7639722f57eebc71cd396512e1fe5c86bebbf15 (diff)
Fixed #22023 -- Raised an error for values() followed by defer() or only().
Previously, doing so resulted in invalid data or crash. Thanks jtiai for the report and Karol Jochelson, Jakub Nowak, Loic Bistuer, and Baptiste Mispelon for reviews.
Diffstat (limited to 'tests')
-rw-r--r--tests/queries/tests.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/queries/tests.py b/tests/queries/tests.py
index 3f861db5d1..7bb5bb34d0 100644
--- a/tests/queries/tests.py
+++ b/tests/queries/tests.py
@@ -1275,6 +1275,16 @@ class Queries3Tests(BaseQuerysetTest):
Item.objects.datetimes, 'name', 'month'
)
+ def test_ticket22023(self):
+ # only() and defer() are not applicable for ValuesQuerySet
+ with self.assertRaisesMessage(NotImplementedError,
+ "ValuesQuerySet does not implement only()"):
+ Valid.objects.values().only()
+
+ with self.assertRaisesMessage(NotImplementedError,
+ "ValuesQuerySet does not implement defer()"):
+ Valid.objects.values().defer()
+
class Queries4Tests(BaseQuerysetTest):
def setUp(self):