Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Malcolm Tredinnick authored March 24, 2008
17  tests/regressiontests/model_regress/models.py
@@ -26,6 +26,9 @@ class Movie(models.Model):
26 26
     movie_id = models.AutoField(primary_key=True)
27 27
     name = models.CharField(max_length=60)
28 28
 
  29
+class Party(models.Model):
  30
+    when = models.DateField()
  31
+
29 32
 __test__ = {'API_TESTS': """
30 33
 (NOTE: Part of the regression test here is merely parsing the model
31 34
 declaration. The verbose_name, in particular, did not always work.)
@@ -51,5 +54,19 @@ class Movie(models.Model):
51 54
 >>> len(a4.article_text)
52 55
 5000
53 56
 
  57
+# #659 regression test
  58
+>>> import datetime
  59
+>>> p = Party.objects.create(when = datetime.datetime(1999, 12, 31))
  60
+>>> p = Party.objects.create(when = datetime.datetime(1998, 12, 31))
  61
+>>> p = Party.objects.create(when = datetime.datetime(1999, 1, 1))
  62
+>>> [p.when for p in Party.objects.filter(when__month = 2)]
  63
+[]
  64
+>>> [p.when for p in Party.objects.filter(when__month = 1)]
  65
+[datetime.date(1999, 1, 1)]
  66
+>>> [p.when for p in Party.objects.filter(when__month = 12)]
  67
+[datetime.date(1999, 12, 31), datetime.date(1998, 12, 31)]
  68
+>>> [p.when for p in Party.objects.filter(when__year = 1998)]
  69
+[datetime.date(1998, 12, 31)]
  70
+
54 71
 """
55 72
 }

0 notes on commit 23912eb

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