1
0
mirror of https://github.com/django/django.git synced 2025-01-03 15:06:09 +00:00

Fixed #2099 -- Allow timezone tests to be ignored on Windows systems, due to

lack of time.tzset(). Patch from SmileyChris.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3862 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2006-09-26 13:38:19 +00:00
parent f5b1da1960
commit 875e7cb815

View File

@ -21,22 +21,22 @@ r"""
'7' '7'
>>> format(my_birthday, 'N') >>> format(my_birthday, 'N')
'July' 'July'
>>> format(my_birthday, 'O') >>> no_tz or format(my_birthday, 'O') == '+0100'
'+0100' True
>>> format(my_birthday, 'P') >>> format(my_birthday, 'P')
'10 p.m.' '10 p.m.'
>>> format(my_birthday, 'r') >>> no_tz or format(my_birthday, 'r') == 'Sun, 8 Jul 1979 22:00:00 +0100'
'Sun, 8 Jul 1979 22:00:00 +0100' True
>>> format(my_birthday, 's') >>> format(my_birthday, 's')
'00' '00'
>>> format(my_birthday, 'S') >>> format(my_birthday, 'S')
'th' 'th'
>>> format(my_birthday, 't') >>> format(my_birthday, 't')
'31' '31'
>>> format(my_birthday, 'T') >>> no_tz or format(my_birthday, 'T') == 'CET'
'CET' True
>>> format(my_birthday, 'U') >>> no_tz or format(my_birthday, 'U') == '300531600'
'300531600' True
>>> format(my_birthday, 'w') >>> format(my_birthday, 'w')
'0' '0'
>>> format(my_birthday, 'W') >>> format(my_birthday, 'W')
@ -47,17 +47,17 @@ r"""
'1979' '1979'
>>> format(my_birthday, 'z') >>> format(my_birthday, 'z')
'189' '189'
>>> format(my_birthday, 'Z') >>> no_tz or format(my_birthday, 'Z') == '3600'
'3600' True
>>> format(summertime, 'I') >>> no_tz or format(summertime, 'I') == '1'
'1' True
>>> format(summertime, 'O') >>> no_tz or format(summertime, 'O') == '+0200'
'+0200' True
>>> format(wintertime, 'I') >>> no_tz or format(wintertime, 'I') == '0'
'0' True
>>> format(wintertime, 'O') >>> no_tz or format(wintertime, 'O') == '+0100'
'+0100' True
>>> format(my_birthday, r'Y z \C\E\T') >>> format(my_birthday, r'Y z \C\E\T')
'1979 189 CET' '1979 189 CET'
@ -73,7 +73,11 @@ format = dateformat.format
os.environ['TZ'] = 'Europe/Copenhagen' os.environ['TZ'] = 'Europe/Copenhagen'
translation.activate('en-us') translation.activate('en-us')
time.tzset() try:
time.tzset()
no_tz = False
except AttributeError:
no_tz = True
my_birthday = datetime.datetime(1979, 7, 8, 22, 00) my_birthday = datetime.datetime(1979, 7, 8, 22, 00)
summertime = datetime.datetime(2005, 10, 30, 1, 00) summertime = datetime.datetime(2005, 10, 30, 1, 00)