summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2012-01-28 20:34:02 +0000
committerAymeric Augustin <aymeric.augustin@m4x.org>2012-01-28 20:34:02 +0000
commit58bcb7d1615511d34c155dedcde981b7f92df788 (patch)
treeb350f131efbb80081a13e37ea2d122e1a7b602b9 /tests
parent6b16580aaa7aa3453a874802e14eaf17db745c46 (diff)
Caught (and tested) the warning added at r17393 in the corresponding test. Refs #17580.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17403 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/modeltests/timezones/tests.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/modeltests/timezones/tests.py b/tests/modeltests/timezones/tests.py
index 41c0016240..3954bc3392 100644
--- a/tests/modeltests/timezones/tests.py
+++ b/tests/modeltests/timezones/tests.py
@@ -264,7 +264,12 @@ class NewDatabaseTests(BaseDateTimeTests):
@requires_tz_support
def test_datetime_from_date(self):
dt = datetime.date(2011, 9, 1)
- Event.objects.create(dt=dt)
+ with warnings.catch_warnings(record=True) as recorded:
+ warnings.simplefilter('always')
+ Event.objects.create(dt=dt)
+ self.assertEqual(len(recorded), 1)
+ msg = str(recorded[0].message)
+ self.assertTrue(msg.startswith("DateTimeField received a naive datetime"))
event = Event.objects.get()
self.assertEqual(event.dt, datetime.datetime(2011, 9, 1, tzinfo=EAT))