From 4fada6f1c9930e589aebe8bdfb5795f69d253c07 Mon Sep 17 00:00:00 2001 From: Michael Hall Date: Mon, 15 Dec 2014 23:49:40 -0700 Subject: [PATCH] Fixed #23893: Added tzinfo to constant datetime in unit test Added tzinfo to y2k constant (01/01/2000) in custom_lookups.tests.DateTimeLookupTests.test_datetime_output_field to fix warning message regarding naive datetimes. --- AUTHORS | 1 + tests/custom_lookups/tests.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index 4adfe2310b..b6a313c336 100644 --- a/AUTHORS +++ b/AUTHORS @@ -465,6 +465,7 @@ answer newbie questions, and generally made Django that much better: Maximillian Dornseif mccutchen@gmail.com Meir Kriheli + Michael Hall Michael Josephson Michael Manfre michael.mcewan@gmail.com diff --git a/tests/custom_lookups/tests.py b/tests/custom_lookups/tests.py index e9a205be5b..945c33a0ec 100644 --- a/tests/custom_lookups/tests.py +++ b/tests/custom_lookups/tests.py @@ -8,6 +8,7 @@ from django.core.exceptions import FieldError from django.db import models from django.db import connection from django.test import TestCase, override_settings +from django.utils import timezone from .models import Author, MySQLUnixTimestamp @@ -376,7 +377,7 @@ class DateTimeLookupTests(TestCase): models.PositiveIntegerField.register_lookup(DateTimeTransform) try: ut = MySQLUnixTimestamp.objects.create(timestamp=time.time()) - y2k = datetime(2000, 1, 1) + y2k = timezone.make_aware(datetime(2000, 1, 1)) self.assertQuerysetEqual( MySQLUnixTimestamp.objects.filter(timestamp__as_datetime__gt=y2k), [ut], lambda x: x)