Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Fixed #18176 -- Added test for year lookups with year < 1000 #847

Merged
merged 1 commit into from about 1 year ago

2 participants

Florian Hahn Aymeric Augustin
Florian Hahn

Thanks Tomas Ehrlich for the initial test

Aymeric Augustin aaugustin merged commit 86b9603 into from February 25, 2013
Aymeric Augustin aaugustin closed this February 25, 2013
Florian Hahn fhahn deleted the branch February 25, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Feb 25, 2013
Florian Hahn Fixed #18176 -- Added test for year lookups with year < 1000
Thanks Tomas Ehrlich for the initial test
f28c301
This page is out of date. Refresh to see the latest.
15  tests/regressiontests/model_regress/tests.py
@@ -57,6 +57,7 @@ def test_date_lookup(self):
57 57
         Party.objects.create(when=datetime.datetime(1999, 12, 31))
58 58
         Party.objects.create(when=datetime.datetime(1998, 12, 31))
59 59
         Party.objects.create(when=datetime.datetime(1999, 1, 1))
  60
+        Party.objects.create(when=datetime.datetime(1, 3, 3))
60 61
         self.assertQuerysetEqual(
61 62
             Party.objects.filter(when__month=2), []
62 63
         )
@@ -104,6 +105,20 @@ def test_date_lookup(self):
104 105
             attrgetter("when")
105 106
         )
106 107
 
  108
+        # Regression test for #18969
  109
+        self.assertQuerysetEqual(
  110
+                Party.objects.filter(when__year=1), [
  111
+                        datetime.date(1, 3, 3),
  112
+                    ],
  113
+                attrgetter("when")
  114
+        )
  115
+        self.assertQuerysetEqual(
  116
+                Party.objects.filter(when__year='1'), [
  117
+                        datetime.date(1, 3, 3),
  118
+                    ],
  119
+                attrgetter("when")
  120
+       )
  121
+
107 122
     def test_date_filter_null(self):
108 123
         # Date filtering was failing with NULL date values in SQLite
109 124
         # (regression test for #3501, amongst other things).
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.