mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Refs #26022 -- Used context manager version of assertRaisesMessage in tests.
This commit is contained in:
parent
3d0dcd7f5a
commit
253adc2b8a
21 changed files with 584 additions and 566 deletions
|
@ -318,7 +318,8 @@ class BasicExpressionsTests(TestCase):
|
|||
'expressions.Company.num_employees. F() expressions can only be '
|
||||
'used to update, not to insert.'
|
||||
)
|
||||
self.assertRaisesMessage(ValueError, msg, acme.save)
|
||||
with self.assertRaisesMessage(ValueError, msg):
|
||||
acme.save()
|
||||
|
||||
acme.num_employees = 12
|
||||
acme.name = Lower(F('name'))
|
||||
|
@ -327,7 +328,8 @@ class BasicExpressionsTests(TestCase):
|
|||
'expressions.Company.name))" on expressions.Company.name. F() '
|
||||
'expressions can only be used to update, not to insert.'
|
||||
)
|
||||
self.assertRaisesMessage(ValueError, msg, acme.save)
|
||||
with self.assertRaisesMessage(ValueError, msg):
|
||||
acme.save()
|
||||
|
||||
def test_ticket_11722_iexact_lookup(self):
|
||||
Employee.objects.create(firstname="John", lastname="Doe")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue