Ticket #9065: 9065-tests.diff

File 9065-tests.diff, 1.6 KB (added by Tom Mortimer-Jones, 16 years ago)
  • tests/regressiontests/templates/filters.py

     
    77consistent.
    88"""
    99
    10 from datetime import datetime, timedelta
     10from datetime import datetime, timedelta, date
    1111
    1212from django.utils.tzinfo import LocalTimezone, FixedOffset
    1313from django.utils.safestring import mark_safe
     
    2828    now = datetime.now()
    2929    now_tz = datetime.now(LocalTimezone(now))
    3030    now_tz_i = datetime.now(FixedOffset((3 * 60) + 15)) # imaginary time zone
     31    today = date.today()
    3132    return {
    3233        # Default compare with datetime.now()
    3334        'filter-timesince01' : ('{{ a|timesince }}', {'a': datetime.now() + timedelta(minutes=-1, seconds = -10)}, '1 minute'),
     
    5556        'filter-timesince15' : ('{{ a|timesince:b }}', {'a': now, 'b': now_tz_i}, ''),
    5657        'filter-timesince16' : ('{{ a|timesince:b }}', {'a': now_tz_i, 'b': now}, ''),
    5758
     59        # Regression for #9065
     60        'filter-timesince17' : ('{{ a|timesince:b }}', {'a': today, 'b': today}, '0 minutes'),
     61        'filter-timesince18' : ('{{ a|timesince:b }}', {'a': today, 'b': today + timedelta(hours=24)}, '1 day'),
     62
    5863        # Default compare with datetime.now()
    5964        'filter-timeuntil01' : ('{{ a|timeuntil }}', {'a':datetime.now() + timedelta(minutes=2, seconds = 10)}, '2 minutes'),
    6065        'filter-timeuntil02' : ('{{ a|timeuntil }}', {'a':(datetime.now() + timedelta(days=1, seconds = 10))}, '1 day'),
Back to Top