From 85f084de39d03df2152661bb3b070623c88daeca Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Wed, 1 Mar 2006 03:12:24 +0000 Subject: [PATCH] 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 --- tests/testapp/models/lookup.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/testapp/models/lookup.py b/tests/testapp/models/lookup.py index 2362bcbef9e..03f5c7ff712 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))