1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Refs #26022 -- Used context manager version of assertRaisesMessage in tests.

This commit is contained in:
Hasan
2016-01-04 12:20:08 +03:30
committed by Tim Graham
parent 3d0dcd7f5a
commit 253adc2b8a
21 changed files with 584 additions and 566 deletions

View File

@@ -47,13 +47,11 @@ class TestSaveLoad(TestCase):
PrimaryKeyUUIDModel.objects.get(pk=[])
def test_wrong_value(self):
self.assertRaisesMessage(
ValueError, 'badly formed hexadecimal UUID string',
UUIDModel.objects.get, field='not-a-uuid')
with self.assertRaisesMessage(ValueError, 'badly formed hexadecimal UUID string'):
UUIDModel.objects.get(field='not-a-uuid')
self.assertRaisesMessage(
ValueError, 'badly formed hexadecimal UUID string',
UUIDModel.objects.create, field='not-a-uuid')
with self.assertRaisesMessage(ValueError, 'badly formed hexadecimal UUID string'):
UUIDModel.objects.create(field='not-a-uuid')
class TestMigrations(SimpleTestCase):