diff options
| author | Warren Smith <warren@wandrsmith.net> | 2013-07-02 17:19:56 -0500 |
|---|---|---|
| committer | Warren Smith <warren@wandrsmith.net> | 2013-08-26 16:15:53 -0500 |
| commit | dd3a883894a219bc6c69e556c694734ab82b33e9 (patch) | |
| tree | 3d78ae088cc8b4f7a848d4a1f03b6e1b4a9c08fd /tests/utils_tests/test_dateformat.py | |
| parent | fa572666998bf5dc70d15ec9386d5d3692b264f2 (diff) | |
Fixed #20693 -- Add timezone support to built-in time filter.
Modified django.utils.dateformat module, moving __init__() method and
timezone-related format methods from DateFormat class to TimeFormat
base class. Modified timezone-related format methods to return an
empty string when timezone is inappropriate for input value.
Diffstat (limited to 'tests/utils_tests/test_dateformat.py')
| -rw-r--r-- | tests/utils_tests/test_dateformat.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/utils_tests/test_dateformat.py b/tests/utils_tests/test_dateformat.py index 15262121a0..2f682b6ce0 100644 --- a/tests/utils_tests/test_dateformat.py +++ b/tests/utils_tests/test_dateformat.py @@ -127,10 +127,16 @@ class DateFormatTests(unittest.TestCase): wintertime = datetime(2005, 10, 30, 4, 00) timestamp = datetime(2008, 5, 19, 11, 45, 23, 123456) + # 3h30m to the west of UTC + tz = FixedOffset(-3*60 - 30) + aware_dt = datetime(2009, 5, 16, 5, 30, 30, tzinfo=tz) + if self.tz_tests: self.assertEqual(dateformat.format(my_birthday, 'O'), '+0100') self.assertEqual(dateformat.format(my_birthday, 'r'), 'Sun, 8 Jul 1979 22:00:00 +0100') self.assertEqual(dateformat.format(my_birthday, 'T'), 'CET') + self.assertEqual(dateformat.format(my_birthday, 'e'), '') + self.assertEqual(dateformat.format(aware_dt, 'e'), '-0330') self.assertEqual(dateformat.format(my_birthday, 'U'), '300315600') self.assertEqual(dateformat.format(timestamp, 'u'), '123456') self.assertEqual(dateformat.format(my_birthday, 'Z'), '3600') @@ -140,7 +146,4 @@ class DateFormatTests(unittest.TestCase): self.assertEqual(dateformat.format(wintertime, 'O'), '+0100') # Ticket #16924 -- We don't need timezone support to test this - # 3h30m to the west of UTC - tz = FixedOffset(-3*60 - 30) - dt = datetime(2009, 5, 16, 5, 30, 30, tzinfo=tz) - self.assertEqual(dateformat.format(dt, 'O'), '-0330') + self.assertEqual(dateformat.format(aware_dt, 'O'), '-0330') |
