Add tests for invalid format specifiers in strftime, and for handling of invalid file descriptors in the os module.

This commit is contained in:
Kristján Valur Jónsson 2009-01-12 18:09:27 +00:00
parent b5bc33cdab
commit 1c62b650d0
2 changed files with 59 additions and 1 deletions

View file

@ -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)