Ticket #21432: tests-21432.diff

File tests-21432.diff, 959 bytes (added by Baptiste Mispelon, 10 years ago)

Failing testcase

  • tests/datetimes/tests.py

    diff --git a/tests/datetimes/tests.py b/tests/datetimes/tests.py
    index f54b30d..cea73c8 100644
    a b  
    11from __future__ import unicode_literals
    22
    33import datetime
     4from unittest import skipIf
     5
     6try:
     7    import pytz
     8except ImportError:
     9    pytz = None
     10
     11from django.test import TestCase, override_settings
     12from django.utils import timezone
    413
    5 from django.test import TestCase
    614
    715from .models import Article, Comment, Category
    816
    class DateTimesTests(TestCase):  
    8189            ],
    8290            lambda d: d,
    8391        )
     92
     93    @skipIf(pytz is None, "this test requires pytz")
     94    @override_settings(USE_TZ=True, TIME_ZONE='Europe/Paris')
     95    def test_21432(self):
     96        now = timezone.now()
     97        Article.objects.create(title="First one", pub_date=now)
     98        qs = Article.objects.datetimes('pub_date', 'year')
     99        self.assertEqual(repr(qs), "[%s]" % now)
Back to Top