Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added a test for month selection under SQLite in case an old possible…

… bug ever

resurfaces. Patch from Pilippe Raoult.

Fixed #659


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7359 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 23912ebbe25e2ef9526164da74e79eb9a7a24d69 1 parent 89e7b67
@malcolmt malcolmt authored
Showing with 17 additions and 0 deletions.
  1. +17 −0 tests/regressiontests/model_regress/models.py
View
17 tests/regressiontests/model_regress/models.py
@@ -26,6 +26,9 @@ class Movie(models.Model):
movie_id = models.AutoField(primary_key=True)
name = models.CharField(max_length=60)
+class Party(models.Model):
+ when = models.DateField()
+
__test__ = {'API_TESTS': """
(NOTE: Part of the regression test here is merely parsing the model
declaration. The verbose_name, in particular, did not always work.)
@@ -51,5 +54,19 @@ class Movie(models.Model):
>>> len(a4.article_text)
5000
+# #659 regression test
+>>> import datetime
+>>> p = Party.objects.create(when = datetime.datetime(1999, 12, 31))
+>>> p = Party.objects.create(when = datetime.datetime(1998, 12, 31))
+>>> p = Party.objects.create(when = datetime.datetime(1999, 1, 1))
+>>> [p.when for p in Party.objects.filter(when__month = 2)]
+[]
+>>> [p.when for p in Party.objects.filter(when__month = 1)]
+[datetime.date(1999, 1, 1)]
+>>> [p.when for p in Party.objects.filter(when__month = 12)]
+[datetime.date(1999, 12, 31), datetime.date(1998, 12, 31)]
+>>> [p.when for p in Party.objects.filter(when__year = 1998)]
+[datetime.date(1998, 12, 31)]
+
"""
}
Please sign in to comment.
Something went wrong with that request. Please try again.