Code

Ticket #9065: 9065-tests.diff

File 9065-tests.diff, 1.6 KB (added by morty, 6 years ago)
Line 
1Index: tests/regressiontests/templates/filters.py
2===================================================================
3--- tests/regressiontests/templates/filters.py  (revision 9033)
4+++ tests/regressiontests/templates/filters.py  (working copy)
5@@ -7,7 +7,7 @@
6 consistent.
7 """
8 
9-from datetime import datetime, timedelta
10+from datetime import datetime, timedelta, date
11 
12 from django.utils.tzinfo import LocalTimezone, FixedOffset
13 from django.utils.safestring import mark_safe
14@@ -28,6 +28,7 @@
15     now = datetime.now()
16     now_tz = datetime.now(LocalTimezone(now))
17     now_tz_i = datetime.now(FixedOffset((3 * 60) + 15)) # imaginary time zone
18+    today = date.today()
19     return {
20         # Default compare with datetime.now()
21         'filter-timesince01' : ('{{ a|timesince }}', {'a': datetime.now() + timedelta(minutes=-1, seconds = -10)}, '1 minute'),
22@@ -55,6 +56,10 @@
23         'filter-timesince15' : ('{{ a|timesince:b }}', {'a': now, 'b': now_tz_i}, ''),
24         'filter-timesince16' : ('{{ a|timesince:b }}', {'a': now_tz_i, 'b': now}, ''),
25 
26+        # Regression for #9065
27+        'filter-timesince17' : ('{{ a|timesince:b }}', {'a': today, 'b': today}, '0 minutes'),
28+        'filter-timesince18' : ('{{ a|timesince:b }}', {'a': today, 'b': today + timedelta(hours=24)}, '1 day'),
29+
30         # Default compare with datetime.now()
31         'filter-timeuntil01' : ('{{ a|timeuntil }}', {'a':datetime.now() + timedelta(minutes=2, seconds = 10)}, '2 minutes'),
32         'filter-timeuntil02' : ('{{ a|timeuntil }}', {'a':(datetime.now() + timedelta(days=1, seconds = 10))}, '1 day'),