Skip to content

Commit

Permalink
Caught (and tested) the warning added at r17393 in the corresponding …
Browse files Browse the repository at this point in the history
…test. Refs #17580.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17403 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
aaugustin committed Jan 28, 2012
1 parent 6b16580 commit 58bcb7d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/modeltests/timezones/tests.py
Expand Up @@ -264,7 +264,12 @@ def test_naive_datetime(self):
@requires_tz_support @requires_tz_support
def test_datetime_from_date(self): def test_datetime_from_date(self):
dt = datetime.date(2011, 9, 1) 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() event = Event.objects.get()
self.assertEqual(event.dt, datetime.datetime(2011, 9, 1, tzinfo=EAT)) self.assertEqual(event.dt, datetime.datetime(2011, 9, 1, tzinfo=EAT))


Expand Down

0 comments on commit 58bcb7d

Please sign in to comment.