mirror of
https://github.com/python/cpython.git
synced 2025-09-13 04:08:37 +00:00
Add tests for invalid format specifiers in strftime, and for handling of invalid file descriptors in the os module.
This commit is contained in:
parent
b5bc33cdab
commit
1c62b650d0
2 changed files with 59 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue