mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Fixed #28650 -- Added TruncWeek database function.
This commit is contained in:
parent
f229049d6c
commit
a455e732a0
12 changed files with 116 additions and 16 deletions
|
@ -55,6 +55,12 @@ class DatesTests(TestCase):
|
|||
datetime.date(2010, 7, 1),
|
||||
],
|
||||
)
|
||||
self.assertSequenceEqual(
|
||||
Comment.objects.dates("article__pub_date", "week"), [
|
||||
datetime.date(2005, 7, 25),
|
||||
datetime.date(2010, 7, 26),
|
||||
],
|
||||
)
|
||||
self.assertSequenceEqual(
|
||||
Comment.objects.dates("article__pub_date", "day"), [
|
||||
datetime.date(2005, 7, 28),
|
||||
|
@ -93,7 +99,8 @@ class DatesTests(TestCase):
|
|||
)
|
||||
|
||||
def test_dates_fails_when_given_invalid_kind_argument(self):
|
||||
with self.assertRaisesMessage(AssertionError, "'kind' must be one of 'year', 'month' or 'day'."):
|
||||
msg = "'kind' must be one of 'year', 'month', 'week', or 'day'."
|
||||
with self.assertRaisesMessage(AssertionError, msg):
|
||||
Article.objects.dates("pub_date", "bad_kind")
|
||||
|
||||
def test_dates_fails_when_given_invalid_order_argument(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue