MCPcopy Index your code
hub / github.com/python/cpython / test_strftime_trailing_percent

Method test_strftime_trailing_percent

Lib/test/datetimetester.py:1632–1646  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1630 t.strftime(format="%f")
1631
1632 def test_strftime_trailing_percent(self):
1633 # bpo-35066: Make sure trailing '%' doesn't cause datetime's strftime to
1634 # complain. Different libcs have different handling of trailing
1635 # percents, so we simply check datetime's strftime acts the same as
1636 # time.strftime.
1637 t = self.theclass(2005, 3, 2)
1638 try:
1639 _time.strftime('%')
1640 except ValueError:
1641 self.skipTest('time module does not support trailing %')
1642 self.assertEqual(t.strftime('%'), _time.strftime('%', t.timetuple()))
1643 self.assertEqual(
1644 t.strftime("m:%m d:%d y:%y %"),
1645 _time.strftime("m:03 d:02 y:05 %", t.timetuple()),
1646 )
1647
1648 def test_format(self):
1649 dt = self.theclass(2007, 9, 10)

Callers

nothing calls this directly

Calls 4

skipTestMethod · 0.80
strftimeMethod · 0.45
assertEqualMethod · 0.45
timetupleMethod · 0.45

Tested by

no test coverage detected