diff options
author | Gregory P. Smith <greg@mad-scientist.com> | 2008-06-02 04:05:52 +0000 |
---|---|---|
committer | Gregory P. Smith <greg@mad-scientist.com> | 2008-06-02 04:05:52 +0000 |
commit | 137d824148f9322c741b16d90ada72fc558b9a1c (patch) | |
tree | 6e2a7c1faa9e5b1e7b6490a735b521d729dfbaad /Lib/test/test_datetime.py | |
parent | 8856ddae2522c644132b5d0730ab60021f2ce13e (diff) | |
download | cpython-git-137d824148f9322c741b16d90ada72fc558b9a1c.tar.gz |
Fix issue 2782: be less strict about the format string type in strftime.
Accept unicode and anything else ParseTuple "s#" can deal with. This
matches the time.strftime behavior.
Diffstat (limited to 'Lib/test/test_datetime.py')
-rw-r--r-- | Lib/test/test_datetime.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_datetime.py b/Lib/test/test_datetime.py index 84f45b4682..cdc9eed6b9 100644 --- a/Lib/test/test_datetime.py +++ b/Lib/test/test_datetime.py @@ -850,9 +850,13 @@ class TestDate(HarmlessMixedComparison, unittest.TestCase): self.assertRaises(TypeError, t.strftime, "one", "two") # too many args self.assertRaises(TypeError, t.strftime, 42) # arg wrong type + # test that unicode input is allowed (issue 2782) + self.assertEqual(t.strftime(u"%m"), "03") + # A naive object replaces %z and %Z w/ empty strings. self.assertEqual(t.strftime("'%z' '%Z'"), "'' ''") + def test_format(self): dt = self.theclass(2007, 9, 10) self.assertEqual(dt.__format__(''), str(dt)) |