From b87114962fa4d5dd4338b763b724f9836a31f63a Mon Sep 17 00:00:00 2001 From: Julien Phalip Date: Fri, 28 Oct 2011 04:11:41 +0000 Subject: [PATCH] Tweaked some `AutoField` tests to not raise wanings in Python>=2.6, where `BaseException.message` has been deprecated. git-svn-id: http://code.djangoproject.com/svn/django/trunk@17045 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/modeltests/validation/models.py | 2 +- tests/modeltests/validation/test_error_messages.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/modeltests/validation/models.py b/tests/modeltests/validation/models.py index 5b90e4b0825..8010701823b 100644 --- a/tests/modeltests/validation/models.py +++ b/tests/modeltests/validation/models.py @@ -102,4 +102,4 @@ try: auto2 = models.AutoField(primary_key=True) except AssertionError, assertion_error: pass # Fail silently -assert assertion_error.message == u"A model can't have more than one AutoField." \ No newline at end of file +assert str(assertion_error) == u"A model can't have more than one AutoField." \ No newline at end of file diff --git a/tests/modeltests/validation/test_error_messages.py b/tests/modeltests/validation/test_error_messages.py index 298f91d8b24..b042c2ee7c9 100644 --- a/tests/modeltests/validation/test_error_messages.py +++ b/tests/modeltests/validation/test_error_messages.py @@ -17,7 +17,7 @@ class ValidationMessagesTest(TestCase): try: models.AutoField(primary_key=False) except AssertionError, e: - self.assertEqual(e.message, u"AutoFields must have primary_key=True.") + self.assertEqual(str(e), "AutoFields must have primary_key=True.") def test_integer_field_raises_error_message(self): f = models.IntegerField()