Ticket #659: 659_tests.diff

File 659_tests.diff, 1.3 KB (added by Philippe Raoult, 17 years ago)

tests proving that SVN doesn't have this bug.

  • tests/regressiontests/model_regress/models.py

     
    2626    movie_id = models.AutoField(primary_key=True)
    2727    name = models.CharField(max_length=60)
    2828
     29class Party(models.Model):
     30    when = models.DateField()
     31
    2932__test__ = {'API_TESTS': """
    3033(NOTE: Part of the regression test here is merely parsing the model
    3134declaration. The verbose_name, in particular, did not always work.)
     
    5154>>> len(a4.article_text)
    52555000
    5356
     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
    5471"""
    5572}
Back to Top