diff options
| author | Georg Bauer <gb@hugo.westfalen.de> | 2005-10-23 10:18:03 +0000 |
|---|---|---|
| committer | Georg Bauer <gb@hugo.westfalen.de> | 2005-10-23 10:18:03 +0000 |
| commit | 174c8a0295c7e3f4782b5a0769de92e3f94bc801 (patch) | |
| tree | f3904f5b731f6314c55341bd5f859484d8cd8ec1 /tests | |
| parent | 15f1da053220394061d0f37447e545597cee6cd9 (diff) | |
| parent | 17f62269c2168549b76ee6204a1423a6e6f4e5f5 (diff) | |
i18n: merged to [992] from trunk
git-svn-id: http://code.djangoproject.com/svn/django/branches/i18n@993 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/othertests/dateformat.py | 75 | ||||
| -rw-r--r-- | tests/testapp/models/custom_pk.py | 4 |
2 files changed, 79 insertions, 0 deletions
diff --git a/tests/othertests/dateformat.py b/tests/othertests/dateformat.py new file mode 100644 index 0000000000..fe8bc8256d --- /dev/null +++ b/tests/othertests/dateformat.py @@ -0,0 +1,75 @@ +""" +>>> format(my_birthday, '') +'' +>>> format(my_birthday, 'a') +'p.m.' +>>> format(my_birthday, 'A') +'PM' +>>> format(my_birthday, 'j') +'7' +>>> format(my_birthday, 'l') +'Saturday' +>>> format(my_birthday, 'L') +'False' +>>> format(my_birthday, 'm') +'07' +>>> format(my_birthday, 'M') +'Jul' +>>> format(my_birthday, 'n') +'7' +>>> format(my_birthday, 'N') +'July' +>>> format(my_birthday, 'O') +'+0100' +>>> format(my_birthday, 'P') +'10 p.m.' +>>> format(my_birthday, 'r') +'Sat, 7 Jul 1979 22:00:00 +0100' +>>> format(my_birthday, 's') +'00' +>>> format(my_birthday, 'S') +'th' +>>> format(my_birthday, 't') +Traceback (most recent call last): + ... +NotImplementedError +>>> format(my_birthday, 'T') +'CET' +>>> format(my_birthday, 'U') +'300445200' +>>> format(my_birthday, 'w') +'6' +>>> format(my_birthday, 'W') +'27' +>>> format(my_birthday, 'y') +'79' +>>> format(my_birthday, 'Y') +'1979' +>>> format(my_birthday, 'z') +'188' +>>> format(my_birthday, 'Z') +'3600' + +>>> format(summertime, 'I') +'1' +>>> format(summertime, 'O') +'+0200' +>>> format(wintertime, 'I') +'0' +>>> format(wintertime, 'O') +'+0100' + +>>> format(my_birthday, 'Y z \\C\\E\\T') +'1979 188 CET' +""" + +from django.utils import dateformat +format = dateformat.format +import datetime, os, time + +os.environ['TZ'] = 'Europe/Copenhagen' +time.tzset() + +my_birthday = datetime.datetime(1979, 7, 7, 22, 00) +summertime = datetime.datetime(2005, 10, 30, 1, 00) +wintertime = datetime.datetime(2005, 10, 30, 4, 00) diff --git a/tests/testapp/models/custom_pk.py b/tests/testapp/models/custom_pk.py index 234b5c3308..5b0eb45462 100644 --- a/tests/testapp/models/custom_pk.py +++ b/tests/testapp/models/custom_pk.py @@ -53,6 +53,8 @@ EmployeeDoesNotExist: Employee does not exist for {'pk': 'foo'} >>> fran.save() >>> employees.get_list(last_name__exact='Jones') [Dan Jones, Fran Jones] +>>> employees.get_in_bulk(['ABC123', 'XYZ456']) +{'XYZ456': Fran Jones, 'ABC123': Dan Jones} >>> b = businesses.Business(name='Sears') >>> b.save() @@ -62,4 +64,6 @@ True [Dan Jones, Fran Jones] >>> fran.get_business_list() [Sears] +>>> businesses.get_in_bulk(['Sears']) +{'Sears': Sears} """ |
