1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Used assertRaisesMessage() to test Django's error messages.

This commit is contained in:
Mads Jensen
2017-05-28 21:37:21 +02:00
committed by Tim Graham
parent 38988f289f
commit a51c4de194
69 changed files with 448 additions and 173 deletions

View File

@@ -21,7 +21,8 @@ class DecimalFieldTests(TestCase):
# Uses default rounding of ROUND_HALF_EVEN.
self.assertEqual(f.to_python(2.0625), Decimal('2.062'))
self.assertEqual(f.to_python(2.1875), Decimal('2.188'))
with self.assertRaises(ValidationError):
msg = "'abc' value must be a decimal number."
with self.assertRaisesMessage(ValidationError, msg):
f.to_python('abc')
def test_default(self):