Code

Ticket #659: 659_tests.diff

File 659_tests.diff, 1.3 KB (added by PhiR, 6 years ago)

tests proving that SVN doesn't have this bug.

Line 
1Index: tests/regressiontests/model_regress/models.py
2===================================================================
3--- tests/regressiontests/model_regress/models.py       (revision 7302)
4+++ tests/regressiontests/model_regress/models.py       (working copy)
5@@ -26,6 +26,9 @@
6     movie_id = models.AutoField(primary_key=True)
7     name = models.CharField(max_length=60)
8 
9+class Party(models.Model):
10+    when = models.DateField()
11+
12 __test__ = {'API_TESTS': """
13 (NOTE: Part of the regression test here is merely parsing the model
14 declaration. The verbose_name, in particular, did not always work.)
15@@ -51,5 +54,19 @@
16 >>> len(a4.article_text)
17 5000
18 
19+# #659 regression test
20+>>> import datetime
21+>>> p = Party.objects.create(when = datetime.datetime(1999, 12, 31))
22+>>> p = Party.objects.create(when = datetime.datetime(1998, 12, 31))
23+>>> p = Party.objects.create(when = datetime.datetime(1999, 1, 1))
24+>>> [p.when for p in Party.objects.filter(when__month = 2)]
25+[]
26+>>> [p.when for p in Party.objects.filter(when__month = 1)]
27+[datetime.date(1999, 1, 1)]
28+>>> [p.when for p in Party.objects.filter(when__month = 12)]
29+[datetime.date(1999, 12, 31), datetime.date(1998, 12, 31)]
30+>>> [p.when for p in Party.objects.filter(when__year = 1998)]
31+[datetime.date(1998, 12, 31)]
32+
33 """
34 }