summaryrefslogtreecommitdiff
path: root/tests/model_fields
diff options
context:
space:
mode:
authorHasan <hasan.r67@gmail.com>2016-01-04 12:20:08 +0330
committerTim Graham <timograham@gmail.com>2016-01-29 13:03:39 -0500
commit253adc2b8a52982139d40c4f55b3fd446e1cb8f3 (patch)
treec508d48636f5b37e97c8078737d398d7475ff8cc /tests/model_fields
parent3d0dcd7f5af378d3ab6adb303b913e6c7b2e0ee5 (diff)
Refs #26022 -- Used context manager version of assertRaisesMessage in tests.
Diffstat (limited to 'tests/model_fields')
-rw-r--r--tests/model_fields/test_uuid.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/tests/model_fields/test_uuid.py b/tests/model_fields/test_uuid.py
index 5cded8d6af..050075444e 100644
--- a/tests/model_fields/test_uuid.py
+++ b/tests/model_fields/test_uuid.py
@@ -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):