diff options
author | Kristján Valur Jónsson <kristjan@ccpgames.com> | 2009-01-12 18:09:27 +0000 |
---|---|---|
committer | Kristján Valur Jónsson <kristjan@ccpgames.com> | 2009-01-12 18:09:27 +0000 |
commit | 1c62b650d0e010f5bf1b7b09a9f629390b557be6 (patch) | |
tree | d5b9235ff107bafd0d74b53262393eb9517c74e0 /Lib/test/test_datetime.py | |
parent | b5bc33cdabc2361afa60463fedd262a6b457dfde (diff) | |
download | cpython-git-1c62b650d0e010f5bf1b7b09a9f629390b557be6.tar.gz |
Add tests for invalid format specifiers in strftime, and for handling of invalid file descriptors in the os module.
Diffstat (limited to 'Lib/test/test_datetime.py')
-rw-r--r-- | Lib/test/test_datetime.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_datetime.py b/Lib/test/test_datetime.py index ff00d8b0b0..89fa5c8e69 100644 --- a/Lib/test/test_datetime.py +++ b/Lib/test/test_datetime.py @@ -856,6 +856,14 @@ class TestDate(HarmlessMixedComparison, unittest.TestCase): # A naive object replaces %z and %Z w/ empty strings. self.assertEqual(t.strftime("'%z' '%Z'"), "'' ''") + #make sure that invalid format specifiers are handled correctly + self.assertRaises(ValueError, t.strftime, "%e") + self.assertRaises(ValueError, t.strftime, "%") + self.assertRaises(ValueError, t.strftime, "%#") + + #check that this standard extension works + t.strftime("%f") + def test_format(self): dt = self.theclass(2007, 9, 10) |