Skip to content

Commit ff751c8

Browse files
Move tests
1 parent 9a93927 commit ff751c8

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

Lib/test/datetimetester.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2921,12 +2921,6 @@ def test_strptime(self):
29212921
with self.assertRaises(ValueError): strptime("-000", "%z")
29222922
with self.assertRaises(ValueError): strptime("z", "%z")
29232923

2924-
# gh-issue: 122781; empty %z should pass
2925-
string = '2025-04-25 11:42:47'
2926-
format = '%Y-%m-%d %H:%M:%S%z'
2927-
result = self.theclass.strptime(string, format)
2928-
self.assertEqual(result, self.theclass(2025, 4, 25, 11, 42, 47))
2929-
29302924
def test_strptime_single_digit(self):
29312925
# bpo-34903: Check that single digit dates and times are allowed.
29322926

@@ -2975,6 +2969,17 @@ def test_strptime_leap_year(self):
29752969
with self._assertNotWarns(DeprecationWarning):
29762970
self.theclass.strptime('02-29,2024', '%m-%d,%Y')
29772971

2972+
def test_strptime_z_empty(self):
2973+
for directive in ('z',):
2974+
string = '2025-04-25 11:42:47'
2975+
format = f'%Y-%m-%d %H:%M:%S%{directive}'
2976+
target = self.theclass(2025, 4, 25, 11, 42, 47)
2977+
with self.subTest(string=string,
2978+
format=format,
2979+
target=target):
2980+
result = self.theclass.strptime(string, format)
2981+
self.assertEqual(result, target)
2982+
29782983
def test_more_timetuple(self):
29792984
# This tests fields beyond those tested by the TestDate.test_timetuple.
29802985
t = self.theclass(2004, 12, 31, 6, 22, 33)

0 commit comments

Comments
 (0)