summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2006-03-01 03:12:24 +0000
committerAdrian Holovaty <adrian@holovaty.com>2006-03-01 03:12:24 +0000
commit85f084de39d03df2152661bb3b070623c88daeca (patch)
treed22dc767f80ef4f44babe1bcc5cb3c64d0e11256
parent3daf7bde2e150c623b80a3a0518196121bd4ea36 (diff)
Added model unit tests for get_DATEFIELD_list(). Refs #1423
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2449 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--tests/testapp/models/lookup.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/testapp/models/lookup.py b/tests/testapp/models/lookup.py
index 2362bcbef9..03f5c7ff71 100644
--- a/tests/testapp/models/lookup.py
+++ b/tests/testapp/models/lookup.py
@@ -127,6 +127,15 @@ Article 2
>>> a2.get_previous_by_pub_date()
Article 1
+# Every DateField and DateTimeField give their model module a get_FOO_list
+# function.
+>>> articles.get_pub_date_list('year')
+[datetime.datetime(2005, 1, 1, 0, 0)]
+>>> articles.get_pub_date_list('month')
+[datetime.datetime(2005, 7, 1, 0, 0), datetime.datetime(2005, 8, 1, 0, 0)]
+>>> articles.get_pub_date_list('day')
+[datetime.datetime(2005, 7, 26, 0, 0), datetime.datetime(2005, 7, 27, 0, 0), datetime.datetime(2005, 7, 28, 0, 0), datetime.datetime(2005, 8, 1, 0, 0)]
+
# Underscores and percent signs have special meaning in the underlying
# database library, but Django handles the quoting of them automatically.
>>> a8 = articles.Article(headline='Article_ with underscore', pub_date=datetime(2005, 11, 20))