Skip to content

Commit

Permalink
pythongh-120713: test that a 0-padded year with century is guaranteed
Browse files Browse the repository at this point in the history
  • Loading branch information
blhsing committed Jun 24, 2024
1 parent 6ca887e commit a9623c4
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions Lib/test/datetimetester.py
Original file line number Diff line number Diff line change
@@ -1699,16 +1699,7 @@ def test_bool(self):
def test_strftime_y2k(self):
for y in (1, 49, 70, 99, 100, 999, 1000, 1970):
d = self.theclass(y, 1, 1)
# Issue 13305: For years < 1000, the value is not always
# padded to 4 digits across platforms. The C standard
# assumes year >= 1900, so it does not specify the number
# of digits.
if d.strftime("%Y") != '%04d' % y:
# Year 42 returns '42', not padded
self.assertEqual(d.strftime("%Y"), '%d' % y)
# '0042' is obtained anyway
if support.has_strftime_extensions:
self.assertEqual(d.strftime("%4Y"), '%04d' % y)
self.assertEqual(d.strftime("%4Y"), '%04d' % y)

def test_replace(self):
cls = self.theclass

0 comments on commit a9623c4

Please sign in to comment.