diff options
| author | Florian Hahn <flo@fhahn.com> | 2013-02-25 17:13:27 +0100 |
|---|---|---|
| committer | Florian Hahn <flo@fhahn.com> | 2013-02-25 17:13:27 +0100 |
| commit | f28c301a4720ef110643728192c27b2ca0ed193a (patch) | |
| tree | c08228f79ff86913026a32a5c420c2f83f0a940a /tests | |
| parent | 6d52bcbb7cb962e4874a8e7a3d1d8ee77233cd19 (diff) | |
Fixed #18176 -- Added test for year lookups with year < 1000
Thanks Tomas Ehrlich for the initial test
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/model_regress/tests.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/regressiontests/model_regress/tests.py b/tests/regressiontests/model_regress/tests.py index c90fe98658..e2d30f0ecc 100644 --- a/tests/regressiontests/model_regress/tests.py +++ b/tests/regressiontests/model_regress/tests.py @@ -57,6 +57,7 @@ class ModelTests(TestCase): 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 @@ class ModelTests(TestCase): 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). |
