mirror of
https://github.com/django/django.git
synced 2025-12-04 00:55:36 +00:00
Refs #32508 -- Raised TypeError instead of using "assert" on unsupported operations for sliced querysets.
This commit is contained in:
parent
6f5dbe9dbe
commit
ba9a2b7544
9 changed files with 60 additions and 30 deletions
|
|
@ -98,6 +98,11 @@ class DistinctOnTests(TestCase):
|
|||
c2 = c1.distinct('pk')
|
||||
self.assertNotIn('OUTER JOIN', str(c2.query))
|
||||
|
||||
def test_sliced_queryset(self):
|
||||
msg = 'Cannot create distinct fields once a slice has been taken.'
|
||||
with self.assertRaisesMessage(TypeError, msg):
|
||||
Staff.objects.all()[0:5].distinct('name')
|
||||
|
||||
def test_transform(self):
|
||||
new_name = self.t1.name.upper()
|
||||
self.assertNotEqual(self.t1.name, new_name)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue