Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Merged
merged 1 commit into from

2 participants

@fhahn

Thanks Tomas Ehrlich for the initial test

@aaugustin aaugustin merged commit 86b9603 into from
@fhahn fhahn deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 25, 2013
  1. @fhahn

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

    fhahn authored
    Thanks Tomas Ehrlich for the initial test
This page is out of date. Refresh to see the latest.
Showing with 15 additions and 0 deletions.
  1. +15 −0 tests/regressiontests/model_regress/tests.py
View
15 tests/regressiontests/model_regress/tests.py
@@ -57,6 +57,7 @@ def test_date_lookup(self):
Party.objects.create(when=datetime.datetime(1999, 12, 31))
Party.objects.create(when=datetime.datetime(1998, 12, 31))
Party.objects.create(when=datetime.datetime(1999, 1, 1))
+ Party.objects.create(when=datetime.datetime(1, 3, 3))
self.assertQuerysetEqual(
Party.objects.filter(when__month=2), []
)
@@ -104,6 +105,20 @@ def test_date_lookup(self):
attrgetter("when")
)
+ # Regression test for #18969
+ self.assertQuerysetEqual(
+ Party.objects.filter(when__year=1), [
+ datetime.date(1, 3, 3),
+ ],
+ attrgetter("when")
+ )
+ self.assertQuerysetEqual(
+ Party.objects.filter(when__year='1'), [
+ datetime.date(1, 3, 3),
+ ],
+ attrgetter("when")
+ )
+
def test_date_filter_null(self):
# Date filtering was failing with NULL date values in SQLite
# (regression test for #3501, amongst other things).
Something went wrong with that request. Please try again.