t.strftime("%f")
def test_strftime_trailing_percent(self):
- # bpo-35066: make sure trailing '%' doesn't cause
- # datetime's strftime to complain
+ # bpo-35066: Make sure trailing '%' doesn't cause datetime's strftime to
+ # complain. Different libcs have different handling of trailing
+ # percents, so we simply check datetime's strftime acts the same as
+ # time.strftime.
t = self.theclass(2005, 3, 2)
try:
_time.strftime('%')
except ValueError:
self.skipTest('time module does not support trailing %')
- self.assertEqual(t.strftime('%'), '%')
- self.assertEqual(t.strftime("m:%m d:%d y:%y %"), "m:03 d:02 y:05 %")
+ self.assertEqual(t.strftime('%'), _time.strftime('%', t.timetuple()))
+ self.assertEqual(
+ t.strftime("m:%m d:%d y:%y %"),
+ _time.strftime("m:03 d:02 y:05 %", t.timetuple()),
+ )
def test_format(self):
dt = self.theclass(2007, 9, 10)