mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +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
|
@ -574,10 +574,8 @@ class FileFieldStorageTests(TestCase):
|
|||
# Testing exception is raised when filename is too short to truncate.
|
||||
filename = 'short.longext'
|
||||
objs[0].limited_length.save(filename, ContentFile('Same Content'))
|
||||
self.assertRaisesMessage(
|
||||
SuspiciousFileOperation, 'Storage can not find an available filename',
|
||||
objs[1].limited_length.save, *(filename, ContentFile('Same Content'))
|
||||
)
|
||||
with self.assertRaisesMessage(SuspiciousFileOperation, 'Storage can not find an available filename'):
|
||||
objs[1].limited_length.save(*(filename, ContentFile('Same Content')))
|
||||
finally:
|
||||
for o in objs:
|
||||
o.delete()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue