mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Refs #26022 -- Used context manager version of assertRaisesMessage in tests.
This commit is contained in:
@@ -90,11 +90,8 @@ class DistinctOnTests(TestCase):
|
||||
|
||||
# Combining queries with different distinct_fields is not allowed.
|
||||
base_qs = Celebrity.objects.all()
|
||||
self.assertRaisesMessage(
|
||||
AssertionError,
|
||||
"Cannot combine queries with different distinct fields.",
|
||||
lambda: (base_qs.distinct('id') & base_qs.distinct('name'))
|
||||
)
|
||||
with self.assertRaisesMessage(AssertionError, "Cannot combine queries with different distinct fields."):
|
||||
base_qs.distinct('id') & base_qs.distinct('name')
|
||||
|
||||
# Test join unreffing
|
||||
c1 = Celebrity.objects.distinct('greatest_fan__id', 'greatest_fan__fan_of')
|
||||
|
||||
Reference in New Issue
Block a user