1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

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.
This commit is contained in:
Michael Hall 2014-12-15 23:49:40 -07:00
parent 4efe1b79e9
commit 4fada6f1c9
2 changed files with 3 additions and 1 deletions

View File

@ -465,6 +465,7 @@ answer newbie questions, and generally made Django that much better:
Maximillian Dornseif <md@hudora.de> Maximillian Dornseif <md@hudora.de>
mccutchen@gmail.com mccutchen@gmail.com
Meir Kriheli <http://mksoft.co.il/> Meir Kriheli <http://mksoft.co.il/>
Michael Hall <mhall1@ualberta.ca>
Michael Josephson <http://www.sdjournal.com/> Michael Josephson <http://www.sdjournal.com/>
Michael Manfre <mmanfre@gmail.com> Michael Manfre <mmanfre@gmail.com>
michael.mcewan@gmail.com michael.mcewan@gmail.com

View File

@ -8,6 +8,7 @@ from django.core.exceptions import FieldError
from django.db import models from django.db import models
from django.db import connection from django.db import connection
from django.test import TestCase, override_settings from django.test import TestCase, override_settings
from django.utils import timezone
from .models import Author, MySQLUnixTimestamp from .models import Author, MySQLUnixTimestamp
@ -376,7 +377,7 @@ class DateTimeLookupTests(TestCase):
models.PositiveIntegerField.register_lookup(DateTimeTransform) models.PositiveIntegerField.register_lookup(DateTimeTransform)
try: try:
ut = MySQLUnixTimestamp.objects.create(timestamp=time.time()) ut = MySQLUnixTimestamp.objects.create(timestamp=time.time())
y2k = datetime(2000, 1, 1) y2k = timezone.make_aware(datetime(2000, 1, 1))
self.assertQuerysetEqual( self.assertQuerysetEqual(
MySQLUnixTimestamp.objects.filter(timestamp__as_datetime__gt=y2k), MySQLUnixTimestamp.objects.filter(timestamp__as_datetime__gt=y2k),
[ut], lambda x: x) [ut], lambda x: x)