summaryrefslogtreecommitdiff
path: root/tests/one_to_one
diff options
context:
space:
mode:
authorMads Jensen <mje@inducks.org>2017-05-28 21:37:21 +0200
committerTim Graham <timograham@gmail.com>2017-07-29 19:07:23 -0400
commita51c4de1945be2225f20fad794cfb52d8f1f9236 (patch)
tree36386b70a27cf027a8a491de319c3e59e0d3d0cd /tests/one_to_one
parent38988f289f7f5708f5ea85de2d5dfe0d86b23106 (diff)
downloaddjango-a51c4de1945be2225f20fad794cfb52d8f1f9236.tar.gz
Used assertRaisesMessage() to test Django's error messages.
Diffstat (limited to 'tests/one_to_one')
-rw-r--r--tests/one_to_one/tests.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/one_to_one/tests.py b/tests/one_to_one/tests.py
index 67eed38a93..82a061b736 100644
--- a/tests/one_to_one/tests.py
+++ b/tests/one_to_one/tests.py
@@ -226,7 +226,11 @@ class OneToOneTests(TestCase):
setattr(p, 'restaurant', None)
# You also can't assign an object of the wrong type here
- with self.assertRaises(ValueError):
+ msg = (
+ 'Cannot assign "<Place: Demon Dogs the place>": '
+ '"Place.restaurant" must be a "Restaurant" instance.'
+ )
+ with self.assertRaisesMessage(ValueError, msg):
setattr(p, 'restaurant', p)
# Creation using keyword argument should cache the related object.