Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Updated and added tests for QuerySet.datetimes.

  • Loading branch information...
commit 50fb7a52462fecf0127b38e7f3df322aeb287c43 1 parent a8451a5
Aymeric Augustin authored February 10, 2013
3  django/db/backends/__init__.py
@@ -397,6 +397,9 @@ class BaseDatabaseFeatures(object):
397 397
     # Can datetimes with timezones be used?
398 398
     supports_timezones = True
399 399
 
  400
+    # Does the database have a copy of the zoneinfo database?
  401
+    has_zoneinfo_database = True
  402
+
400 403
     # When performing a GROUP BY, is an ORDER BY NULL required
401 404
     # to remove any ordering?
402 405
     requires_explicit_null_ordering_when_grouping = False
128  tests/modeltests/timezones/tests.py
@@ -189,13 +189,16 @@ def test_query_filter(self):
189 189
         self.assertEqual(Event.objects.filter(dt__gte=dt2).count(), 1)
190 190
         self.assertEqual(Event.objects.filter(dt__gt=dt2).count(), 0)
191 191
 
192  
-    def test_query_date_related_filters(self):
  192
+    def test_query_datetime_lookups(self):
193 193
         Event.objects.create(dt=datetime.datetime(2011, 1, 1, 1, 30, 0))
194 194
         Event.objects.create(dt=datetime.datetime(2011, 1, 1, 4, 30, 0))
195 195
         self.assertEqual(Event.objects.filter(dt__year=2011).count(), 2)
196 196
         self.assertEqual(Event.objects.filter(dt__month=1).count(), 2)
197 197
         self.assertEqual(Event.objects.filter(dt__day=1).count(), 2)
198 198
         self.assertEqual(Event.objects.filter(dt__week_day=7).count(), 2)
  199
+        self.assertEqual(Event.objects.filter(dt__hour=1).count(), 1)
  200
+        self.assertEqual(Event.objects.filter(dt__minute=30).count(), 2)
  201
+        self.assertEqual(Event.objects.filter(dt__second=0).count(), 2)
199 202
 
200 203
     def test_query_aggregation(self):
201 204
         # Only min and max make sense for datetimes.
@@ -230,15 +233,30 @@ def test_query_annotation(self):
230 233
                 [afternoon_min_dt],
231 234
                 transform=lambda d: d.dt)
232 235
 
233  
-    def test_query_dates(self):
  236
+    def test_query_datetimes(self):
234 237
         Event.objects.create(dt=datetime.datetime(2011, 1, 1, 1, 30, 0))
235 238
         Event.objects.create(dt=datetime.datetime(2011, 1, 1, 4, 30, 0))
236  
-        self.assertQuerysetEqual(Event.objects.dates('dt', 'year'),
237  
-                [datetime.datetime(2011, 1, 1)], transform=lambda d: d)
238  
-        self.assertQuerysetEqual(Event.objects.dates('dt', 'month'),
239  
-                [datetime.datetime(2011, 1, 1)], transform=lambda d: d)
240  
-        self.assertQuerysetEqual(Event.objects.dates('dt', 'day'),
241  
-                [datetime.datetime(2011, 1, 1)], transform=lambda d: d)
  239
+        self.assertQuerysetEqual(Event.objects.datetimes('dt', 'year'),
  240
+                [datetime.datetime(2011, 1, 1, 0, 0, 0)],
  241
+                transform=lambda d: d)
  242
+        self.assertQuerysetEqual(Event.objects.datetimes('dt', 'month'),
  243
+                [datetime.datetime(2011, 1, 1, 0, 0, 0)],
  244
+                transform=lambda d: d)
  245
+        self.assertQuerysetEqual(Event.objects.datetimes('dt', 'day'),
  246
+                [datetime.datetime(2011, 1, 1, 0, 0, 0)],
  247
+                transform=lambda d: d)
  248
+        self.assertQuerysetEqual(Event.objects.datetimes('dt', 'hour'),
  249
+                [datetime.datetime(2011, 1, 1, 1, 0, 0),
  250
+                 datetime.datetime(2011, 1, 1, 4, 0, 0)],
  251
+                transform=lambda d: d)
  252
+        self.assertQuerysetEqual(Event.objects.datetimes('dt', 'minute'),
  253
+                [datetime.datetime(2011, 1, 1, 1, 30, 0),
  254
+                 datetime.datetime(2011, 1, 1, 4, 30, 0)],
  255
+                transform=lambda d: d)
  256
+        self.assertQuerysetEqual(Event.objects.datetimes('dt', 'second'),
  257
+                [datetime.datetime(2011, 1, 1, 1, 30, 0),
  258
+                 datetime.datetime(2011, 1, 1, 4, 30, 0)],
  259
+                transform=lambda d: d)
242 260
 
243 261
     def test_raw_sql(self):
244 262
         # Regression test for #17755
@@ -398,17 +416,32 @@ def test_query_filter_with_naive_datetime(self):
398 416
                 msg = str(warning.message)
399 417
                 self.assertTrue(msg.startswith("DateTimeField received a naive datetime"))
400 418
 
401  
-    def test_query_date_related_filters(self):
402  
-        # These two dates fall in the same day in EAT, but in different days,
403  
-        # years and months in UTC, and aggregation is performed in UTC when
404  
-        # time zone support is enabled. This test could be changed if the
405  
-        # implementation is changed to perform the aggregation is local time.
  419
+    @skipUnlessDBFeature('has_zoneinfo_database')
  420
+    def test_query_datetime_lookups(self):
406 421
         Event.objects.create(dt=datetime.datetime(2011, 1, 1, 1, 30, 0, tzinfo=EAT))
407 422
         Event.objects.create(dt=datetime.datetime(2011, 1, 1, 4, 30, 0, tzinfo=EAT))
408  
-        self.assertEqual(Event.objects.filter(dt__year=2011).count(), 1)
409  
-        self.assertEqual(Event.objects.filter(dt__month=1).count(), 1)
410  
-        self.assertEqual(Event.objects.filter(dt__day=1).count(), 1)
411  
-        self.assertEqual(Event.objects.filter(dt__week_day=7).count(), 1)
  423
+        self.assertEqual(Event.objects.filter(dt__year=2011).count(), 2)
  424
+        self.assertEqual(Event.objects.filter(dt__month=1).count(), 2)
  425
+        self.assertEqual(Event.objects.filter(dt__day=1).count(), 2)
  426
+        self.assertEqual(Event.objects.filter(dt__week_day=7).count(), 2)
  427
+        self.assertEqual(Event.objects.filter(dt__hour=1).count(), 1)
  428
+        self.assertEqual(Event.objects.filter(dt__minute=30).count(), 2)
  429
+        self.assertEqual(Event.objects.filter(dt__second=0).count(), 2)
  430
+
  431
+    @skipUnlessDBFeature('has_zoneinfo_database')
  432
+    def test_query_datetime_lookups_in_other_timezone(self):
  433
+        Event.objects.create(dt=datetime.datetime(2011, 1, 1, 1, 30, 0, tzinfo=EAT))
  434
+        Event.objects.create(dt=datetime.datetime(2011, 1, 1, 4, 30, 0, tzinfo=EAT))
  435
+        with timezone.override(UTC):
  436
+            # These two dates fall in the same day in EAT, but in different days,
  437
+            # years and months in UTC.
  438
+            self.assertEqual(Event.objects.filter(dt__year=2011).count(), 1)
  439
+            self.assertEqual(Event.objects.filter(dt__month=1).count(), 1)
  440
+            self.assertEqual(Event.objects.filter(dt__day=1).count(), 1)
  441
+            self.assertEqual(Event.objects.filter(dt__week_day=7).count(), 1)
  442
+            self.assertEqual(Event.objects.filter(dt__hour=22).count(), 1)
  443
+            self.assertEqual(Event.objects.filter(dt__minute=30).count(), 2)
  444
+            self.assertEqual(Event.objects.filter(dt__second=0).count(), 2)
412 445
 
413 446
     def test_query_aggregation(self):
414 447
         # Only min and max make sense for datetimes.
@@ -443,22 +476,61 @@ def test_query_annotation(self):
443 476
                 [afternoon_min_dt],
444 477
                 transform=lambda d: d.dt)
445 478
 
446  
-    def test_query_dates(self):
447  
-        # Same comment as in test_query_date_related_filters.
  479
+    @skipUnlessDBFeature('has_zoneinfo_database')
  480
+    def test_query_datetimes(self):
448 481
         Event.objects.create(dt=datetime.datetime(2011, 1, 1, 1, 30, 0, tzinfo=EAT))
449 482
         Event.objects.create(dt=datetime.datetime(2011, 1, 1, 4, 30, 0, tzinfo=EAT))
450  
-        self.assertQuerysetEqual(Event.objects.dates('dt', 'year'),
451  
-                [datetime.datetime(2010, 1, 1, tzinfo=UTC),
452  
-                 datetime.datetime(2011, 1, 1, tzinfo=UTC)],
  483
+        self.assertQuerysetEqual(Event.objects.datetimes('dt', 'year'),
  484
+                [datetime.datetime(2011, 1, 1, 0, 0, 0, tzinfo=EAT)],
  485
+                transform=lambda d: d)
  486
+        self.assertQuerysetEqual(Event.objects.datetimes('dt', 'month'),
  487
+                [datetime.datetime(2011, 1, 1, 0, 0, 0, tzinfo=EAT)],
  488
+                transform=lambda d: d)
  489
+        self.assertQuerysetEqual(Event.objects.datetimes('dt', 'day'),
  490
+                [datetime.datetime(2011, 1, 1, 0, 0, 0, tzinfo=EAT)],
453 491
                 transform=lambda d: d)
454  
-        self.assertQuerysetEqual(Event.objects.dates('dt', 'month'),
455  
-                [datetime.datetime(2010, 12, 1, tzinfo=UTC),
456  
-                 datetime.datetime(2011, 1, 1, tzinfo=UTC)],
  492
+        self.assertQuerysetEqual(Event.objects.datetimes('dt', 'hour'),
  493
+                [datetime.datetime(2011, 1, 1, 1, 0, 0, tzinfo=EAT),
  494
+                 datetime.datetime(2011, 1, 1, 4, 0, 0, tzinfo=EAT)],
457 495
                 transform=lambda d: d)
458  
-        self.assertQuerysetEqual(Event.objects.dates('dt', 'day'),
459  
-                [datetime.datetime(2010, 12, 31, tzinfo=UTC),
460  
-                 datetime.datetime(2011, 1, 1, tzinfo=UTC)],
  496
+        self.assertQuerysetEqual(Event.objects.datetimes('dt', 'minute'),
  497
+                [datetime.datetime(2011, 1, 1, 1, 30, 0, tzinfo=EAT),
  498
+                 datetime.datetime(2011, 1, 1, 4, 30, 0, tzinfo=EAT)],
461 499
                 transform=lambda d: d)
  500
+        self.assertQuerysetEqual(Event.objects.datetimes('dt', 'second'),
  501
+                [datetime.datetime(2011, 1, 1, 1, 30, 0, tzinfo=EAT),
  502
+                 datetime.datetime(2011, 1, 1, 4, 30, 0, tzinfo=EAT)],
  503
+                transform=lambda d: d)
  504
+
  505
+    @skipUnlessDBFeature('has_zoneinfo_database')
  506
+    def test_query_datetimes_in_other_timezone(self):
  507
+        Event.objects.create(dt=datetime.datetime(2011, 1, 1, 1, 30, 0, tzinfo=EAT))
  508
+        Event.objects.create(dt=datetime.datetime(2011, 1, 1, 4, 30, 0, tzinfo=EAT))
  509
+        with timezone.override(UTC):
  510
+            self.assertQuerysetEqual(Event.objects.datetimes('dt', 'year'),
  511
+                    [datetime.datetime(2010, 1, 1, 0, 0, 0, tzinfo=UTC),
  512
+                     datetime.datetime(2011, 1, 1, 0, 0, 0, tzinfo=UTC)],
  513
+                    transform=lambda d: d)
  514
+            self.assertQuerysetEqual(Event.objects.datetimes('dt', 'month'),
  515
+                    [datetime.datetime(2010, 12, 1, 0, 0, 0, tzinfo=UTC),
  516
+                     datetime.datetime(2011, 1, 1, 0, 0, 0, tzinfo=UTC)],
  517
+                    transform=lambda d: d)
  518
+            self.assertQuerysetEqual(Event.objects.datetimes('dt', 'day'),
  519
+                    [datetime.datetime(2010, 12, 31, 0, 0, 0, tzinfo=UTC),
  520
+                     datetime.datetime(2011, 1, 1, 0, 0, 0, tzinfo=UTC)],
  521
+                    transform=lambda d: d)
  522
+            self.assertQuerysetEqual(Event.objects.datetimes('dt', 'hour'),
  523
+                    [datetime.datetime(2010, 12, 31, 22, 0, 0, tzinfo=UTC),
  524
+                     datetime.datetime(2011, 1, 1, 1, 0, 0, tzinfo=UTC)],
  525
+                    transform=lambda d: d)
  526
+            self.assertQuerysetEqual(Event.objects.datetimes('dt', 'minute'),
  527
+                    [datetime.datetime(2010, 12, 31, 22, 30, 0, tzinfo=UTC),
  528
+                     datetime.datetime(2011, 1, 1, 1, 30, 0, tzinfo=UTC)],
  529
+                    transform=lambda d: d)
  530
+            self.assertQuerysetEqual(Event.objects.datetimes('dt', 'second'),
  531
+                    [datetime.datetime(2010, 12, 31, 22, 30, 0, tzinfo=UTC),
  532
+                     datetime.datetime(2011, 1, 1, 1, 30, 0, tzinfo=UTC)],
  533
+                    transform=lambda d: d)
462 534
 
463 535
     def test_raw_sql(self):
464 536
         # Regression test for #17755
4  tests/regressiontests/backends/tests.py
@@ -146,9 +146,9 @@ def test_django_date_trunc(self):
146 146
         years = models.SchoolClass.objects.dates('last_updated', 'year')
147 147
         self.assertEqual(list(years), [datetime.datetime(2010, 1, 1, 0, 0)])
148 148
 
149  
-    def test_django_extract(self):
  149
+    def test_django_date_extract(self):
150 150
         """
151  
-        Test the custom ``django_extract method``, in particular against fields
  151
+        Test the custom ``django_date_extract method``, in particular against fields
152 152
         which clash with strings passed to it (e.g. 'day') - see #12818__.
153 153
 
154 154
         __: http://code.djangoproject.com/ticket/12818
2  tests/regressiontests/dates/models.py
... ...
@@ -1,3 +1,5 @@
  1
+from __future__ import unicode_literals
  2
+
1 3
 from django.db import models
2 4
 from django.utils.encoding import python_2_unicode_compatible
3 5
 
38  tests/regressiontests/dates/tests.py
... ...
@@ -1,6 +1,6 @@
1 1
 from __future__ import absolute_import
2 2
 
3  
-from datetime import datetime
  3
+import datetime
4 4
 
5 5
 from django.test import TestCase
6 6
 
@@ -11,32 +11,32 @@ class DatesTests(TestCase):
11 11
     def test_related_model_traverse(self):
12 12
         a1 = Article.objects.create(
13 13
             title="First one",
14  
-            pub_date=datetime(2005, 7, 28),
  14
+            pub_date=datetime.date(2005, 7, 28),
15 15
         )
16 16
         a2 = Article.objects.create(
17 17
             title="Another one",
18  
-            pub_date=datetime(2010, 7, 28),
  18
+            pub_date=datetime.date(2010, 7, 28),
19 19
         )
20 20
         a3 = Article.objects.create(
21 21
             title="Third one, in the first day",
22  
-            pub_date=datetime(2005, 7, 28),
  22
+            pub_date=datetime.date(2005, 7, 28),
23 23
         )
24 24
 
25 25
         a1.comments.create(
26 26
             text="Im the HULK!",
27  
-            pub_date=datetime(2005, 7, 28),
  27
+            pub_date=datetime.date(2005, 7, 28),
28 28
         )
29 29
         a1.comments.create(
30 30
             text="HULK SMASH!",
31  
-            pub_date=datetime(2005, 7, 29),
  31
+            pub_date=datetime.date(2005, 7, 29),
32 32
         )
33 33
         a2.comments.create(
34 34
             text="LMAO",
35  
-            pub_date=datetime(2010, 7, 28),
  35
+            pub_date=datetime.date(2010, 7, 28),
36 36
         )
37 37
         a3.comments.create(
38 38
             text="+1",
39  
-            pub_date=datetime(2005, 8, 29),
  39
+            pub_date=datetime.date(2005, 8, 29),
40 40
         )
41 41
 
42 42
         c = Category.objects.create(name="serious-news")
@@ -44,31 +44,31 @@ def test_related_model_traverse(self):
44 44
 
45 45
         self.assertQuerysetEqual(
46 46
             Comment.objects.dates("article__pub_date", "year"), [
47  
-                datetime(2005, 1, 1),
48  
-                datetime(2010, 1, 1),
  47
+                datetime.date(2005, 1, 1),
  48
+                datetime.date(2010, 1, 1),
49 49
             ],
50 50
             lambda d: d,
51 51
         )
52 52
         self.assertQuerysetEqual(
53 53
             Comment.objects.dates("article__pub_date", "month"), [
54  
-                datetime(2005, 7, 1),
55  
-                datetime(2010, 7, 1),
  54
+                datetime.date(2005, 7, 1),
  55
+                datetime.date(2010, 7, 1),
56 56
             ],
57 57
             lambda d: d
58 58
         )
59 59
         self.assertQuerysetEqual(
60 60
             Comment.objects.dates("article__pub_date", "day"), [
61  
-                datetime(2005, 7, 28),
62  
-                datetime(2010, 7, 28),
  61
+                datetime.date(2005, 7, 28),
  62
+                datetime.date(2010, 7, 28),
63 63
             ],
64 64
             lambda d: d
65 65
         )
66 66
         self.assertQuerysetEqual(
67 67
             Article.objects.dates("comments__pub_date", "day"), [
68  
-                datetime(2005, 7, 28),
69  
-                datetime(2005, 7, 29),
70  
-                datetime(2005, 8, 29),
71  
-                datetime(2010, 7, 28),
  68
+                datetime.date(2005, 7, 28),
  69
+                datetime.date(2005, 7, 29),
  70
+                datetime.date(2005, 8, 29),
  71
+                datetime.date(2010, 7, 28),
72 72
             ],
73 73
             lambda d: d
74 74
         )
@@ -77,7 +77,7 @@ def test_related_model_traverse(self):
77 77
         )
78 78
         self.assertQuerysetEqual(
79 79
             Category.objects.dates("articles__pub_date", "day"), [
80  
-                datetime(2005, 7, 28),
  80
+                datetime.date(2005, 7, 28),
81 81
             ],
82 82
             lambda d: d,
83 83
         )
0  tests/regressiontests/datetimes/__init__.py
No changes.
28  tests/regressiontests/datetimes/models.py
... ...
@@ -0,0 +1,28 @@
  1
+from __future__ import unicode_literals
  2
+
  3
+from django.db import models
  4
+from django.utils.encoding import python_2_unicode_compatible
  5
+
  6
+
  7
+@python_2_unicode_compatible
  8
+class Article(models.Model):
  9
+    title = models.CharField(max_length=100)
  10
+    pub_date = models.DateTimeField()
  11
+
  12
+    categories = models.ManyToManyField("Category", related_name="articles")
  13
+
  14
+    def __str__(self):
  15
+        return self.title
  16
+
  17
+@python_2_unicode_compatible
  18
+class Comment(models.Model):
  19
+    article = models.ForeignKey(Article, related_name="comments")
  20
+    text = models.TextField()
  21
+    pub_date = models.DateTimeField()
  22
+    approval_date = models.DateTimeField(null=True)
  23
+
  24
+    def __str__(self):
  25
+        return 'Comment to %s (%s)' % (self.article.title, self.pub_date)
  26
+
  27
+class Category(models.Model):
  28
+    name = models.CharField(max_length=255)
83  tests/regressiontests/datetimes/tests.py
... ...
@@ -0,0 +1,83 @@
  1
+from __future__ import absolute_import
  2
+
  3
+import datetime
  4
+
  5
+from django.test import TestCase
  6
+
  7
+from .models import Article, Comment, Category
  8
+
  9
+
  10
+class DateTimesTests(TestCase):
  11
+    def test_related_model_traverse(self):
  12
+        a1 = Article.objects.create(
  13
+            title="First one",
  14
+            pub_date=datetime.datetime(2005, 7, 28, 9, 0, 0),
  15
+        )
  16
+        a2 = Article.objects.create(
  17
+            title="Another one",
  18
+            pub_date=datetime.datetime(2010, 7, 28, 10, 0, 0),
  19
+        )
  20
+        a3 = Article.objects.create(
  21
+            title="Third one, in the first day",
  22
+            pub_date=datetime.datetime(2005, 7, 28, 17, 0, 0),
  23
+        )
  24
+
  25
+        a1.comments.create(
  26
+            text="Im the HULK!",
  27
+            pub_date=datetime.datetime(2005, 7, 28, 9, 30, 0),
  28
+        )
  29
+        a1.comments.create(
  30
+            text="HULK SMASH!",
  31
+            pub_date=datetime.datetime(2005, 7, 29, 1, 30, 0),
  32
+        )
  33
+        a2.comments.create(
  34
+            text="LMAO",
  35
+            pub_date=datetime.datetime(2010, 7, 28, 10, 10, 10),
  36
+        )
  37
+        a3.comments.create(
  38
+            text="+1",
  39
+            pub_date=datetime.datetime(2005, 8, 29, 10, 10, 10),
  40
+        )
  41
+
  42
+        c = Category.objects.create(name="serious-news")
  43
+        c.articles.add(a1, a3)
  44
+
  45
+        self.assertQuerysetEqual(
  46
+            Comment.objects.datetimes("article__pub_date", "year"), [
  47
+                datetime.datetime(2005, 1, 1),
  48
+                datetime.datetime(2010, 1, 1),
  49
+            ],
  50
+            lambda d: d,
  51
+        )
  52
+        self.assertQuerysetEqual(
  53
+            Comment.objects.datetimes("article__pub_date", "month"), [
  54
+                datetime.datetime(2005, 7, 1),
  55
+                datetime.datetime(2010, 7, 1),
  56
+            ],
  57
+            lambda d: d
  58
+        )
  59
+        self.assertQuerysetEqual(
  60
+            Comment.objects.datetimes("article__pub_date", "day"), [
  61
+                datetime.datetime(2005, 7, 28),
  62
+                datetime.datetime(2010, 7, 28),
  63
+            ],
  64
+            lambda d: d
  65
+        )
  66
+        self.assertQuerysetEqual(
  67
+            Article.objects.datetimes("comments__pub_date", "day"), [
  68
+                datetime.datetime(2005, 7, 28),
  69
+                datetime.datetime(2005, 7, 29),
  70
+                datetime.datetime(2005, 8, 29),
  71
+                datetime.datetime(2010, 7, 28),
  72
+            ],
  73
+            lambda d: d
  74
+        )
  75
+        self.assertQuerysetEqual(
  76
+            Article.objects.datetimes("comments__approval_date", "day"), []
  77
+        )
  78
+        self.assertQuerysetEqual(
  79
+            Category.objects.datetimes("articles__pub_date", "day"), [
  80
+                datetime.datetime(2005, 7, 28),
  81
+            ],
  82
+            lambda d: d,
  83
+        )
5  tests/regressiontests/generic_views/dates.py
@@ -4,7 +4,7 @@
4 4
 import datetime
5 5
 
6 6
 from django.core.exceptions import ImproperlyConfigured
7  
-from django.test import TestCase
  7
+from django.test import TestCase, skipUnlessDBFeature
8 8
 from django.test.utils import override_settings
9 9
 from django.utils import timezone
10 10
 from django.utils.unittest import skipUnless
@@ -119,6 +119,7 @@ def test_datetime_archive_view(self):
119 119
         self.assertEqual(res.status_code, 200)
120 120
 
121 121
     @requires_tz_support
  122
+    @skipUnlessDBFeature('has_zoneinfo_database')
122 123
     @override_settings(USE_TZ=True, TIME_ZONE='Africa/Nairobi')
123 124
     def test_aware_datetime_archive_view(self):
124 125
         BookSigning.objects.create(event_date=datetime.datetime(2008, 4, 2, 12, 0, tzinfo=timezone.utc))
@@ -204,6 +205,7 @@ def test_datetime_year_view(self):
204 205
         res = self.client.get('/dates/booksignings/2008/')
205 206
         self.assertEqual(res.status_code, 200)
206 207
 
  208
+    @skipUnlessDBFeature('has_zoneinfo_database')
207 209
     @override_settings(USE_TZ=True, TIME_ZONE='Africa/Nairobi')
208 210
     def test_aware_datetime_year_view(self):
209 211
         BookSigning.objects.create(event_date=datetime.datetime(2008, 4, 2, 12, 0, tzinfo=timezone.utc))
@@ -328,6 +330,7 @@ def test_datetime_month_view(self):
328 330
         res = self.client.get('/dates/booksignings/2008/apr/')
329 331
         self.assertEqual(res.status_code, 200)
330 332
 
  333
+    @skipUnlessDBFeature('has_zoneinfo_database')
331 334
     @override_settings(USE_TZ=True, TIME_ZONE='Africa/Nairobi')
332 335
     def test_aware_datetime_month_view(self):
333 336
         BookSigning.objects.create(event_date=datetime.datetime(2008, 2, 1, 12, 0, tzinfo=timezone.utc))

0 notes on commit 50fb7a5

Please sign in to comment.
Something went wrong with that request. Please try again.