Skip to content

Commit 88c6f02

Browse files
committed
refactor test for %F and %T as requested
1 parent 029ed4f commit 88c6f02

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Lib/test/datetimetester.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,18 +1213,18 @@ def test_strptime_leap_year(self):
12131213
date.strptime('02-29,2024', '%m-%d,%Y')
12141214

12151215
def test_strptime_F_format(self):
1216-
formats = dict(short="%F",long="%Y-%m-%d")
12171216
test_date = "2025-10-26"
1218-
shorthand = datetime.strptime(test_date,formats["short"])
1219-
long_hand = datetime.strptime(test_date,formats["long"])
1220-
self.assertEqual(shorthand,long_hand)
1217+
self.assertEqual(
1218+
datetime.strptime(test_date,"%F"),
1219+
datetime.strptime(test_date,"%Y-%m-%d")
1220+
)
12211221

12221222
def test_strptime_T_format(self):
1223-
formats = dict(short="%T",long="%H:%M:%S")
12241223
test_time = "15:00:00"
1225-
shorthand = datetime.strptime(test_time,formats["short"])
1226-
long_hand = datetime.strptime(test_time,formats["long"])
1227-
self.assertEqual(shorthand,long_hand)
1224+
self.assertEqual(
1225+
datetime.strptime(test_time,"%T"),
1226+
datetime.strptime(test_time,"%H:%M:%S")
1227+
)
12281228

12291229
class SubclassDate(date):
12301230
sub_var = 1

0 commit comments

Comments
 (0)