diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2006-08-27 13:59:47 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2006-08-27 13:59:47 +0000 |
| commit | 97b9ad73b4889ffebb3da2239b472bbfd1600177 (patch) | |
| tree | 89acb1efa72ac38c1fc66709ef1f4e108876f10f /tests/regressiontests/dateformat | |
| parent | 77ab11be452d2da50925d5d2e3eed1b96ba7eca0 (diff) | |
Refs #2333 - Modified runtests script to use new testing framework. Migrated existing tests to use Django testing framework. All the 'othertests' have been migrated into 'regressiontests', and converted into doctests/unittests, as appropriate.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3661 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/dateformat')
| -rw-r--r-- | tests/regressiontests/dateformat/__init__.py | 0 | ||||
| -rw-r--r-- | tests/regressiontests/dateformat/models.py | 0 | ||||
| -rw-r--r-- | tests/regressiontests/dateformat/tests.py | 80 |
3 files changed, 80 insertions, 0 deletions
diff --git a/tests/regressiontests/dateformat/__init__.py b/tests/regressiontests/dateformat/__init__.py new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/regressiontests/dateformat/__init__.py diff --git a/tests/regressiontests/dateformat/models.py b/tests/regressiontests/dateformat/models.py new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/regressiontests/dateformat/models.py diff --git a/tests/regressiontests/dateformat/tests.py b/tests/regressiontests/dateformat/tests.py new file mode 100644 index 0000000000..0287587b4a --- /dev/null +++ b/tests/regressiontests/dateformat/tests.py @@ -0,0 +1,80 @@ +r""" +>>> format(my_birthday, '') +'' +>>> format(my_birthday, 'a') +'p.m.' +>>> format(my_birthday, 'A') +'PM' +>>> format(my_birthday, 'd') +'08' +>>> format(my_birthday, 'j') +'8' +>>> format(my_birthday, 'l') +'Sunday' +>>> 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') +'Sun, 8 Jul 1979 22:00:00 +0100' +>>> format(my_birthday, 's') +'00' +>>> format(my_birthday, 'S') +'th' +>>> format(my_birthday, 't') +'31' +>>> format(my_birthday, 'T') +'CET' +>>> format(my_birthday, 'U') +'300531600' +>>> format(my_birthday, 'w') +'0' +>>> format(my_birthday, 'W') +'27' +>>> format(my_birthday, 'y') +'79' +>>> format(my_birthday, 'Y') +'1979' +>>> format(my_birthday, 'z') +'189' +>>> format(my_birthday, 'Z') +'3600' + +>>> format(summertime, 'I') +'1' +>>> format(summertime, 'O') +'+0200' +>>> format(wintertime, 'I') +'0' +>>> format(wintertime, 'O') +'+0100' + +>>> format(my_birthday, r'Y z \C\E\T') +'1979 189 CET' + +>>> format(my_birthday, r'jS o\f F') +'8th of July' +""" + +from django.utils import dateformat, translation +import datetime, os, time + +format = dateformat.format +os.environ['TZ'] = 'Europe/Copenhagen' +translation.activate('en-us') + +time.tzset() + +my_birthday = datetime.datetime(1979, 7, 8, 22, 00) +summertime = datetime.datetime(2005, 10, 30, 1, 00) +wintertime = datetime.datetime(2005, 10, 30, 4, 00) |
