@@ -2207,32 +2207,19 @@ def test_strptime_D_format(self):
22072207 self .theclass .strptime (test_date , "%m/%d/%y" )
22082208 )
22092209
2210- def test_strptime_t_format (self ):
2211- test_year ,test_month ,test_day = 2026 ,2 ,20
2212- whitespaces = ('' ,' ' ,'\t ' ,'\r ' ,'\v ' ,'\n ' ,'\f ' )
2213- for ws in (* whitespaces ,'' .join (whitespaces )):
2214- with self .subTest (whitespace = ws ):
2215- self .assertEqual (
2216- self .theclass .strptime (
2217- f'{ test_year :04d} { ws } { test_month :02d} { ws } { test_day :02d} ' ,
2218- "%Y%t%m%t%d"
2219- ),
2220- self .theclass (test_year ,test_month ,test_day )
2221- )
2222-
2223- def test_strptime_n_format (self ):
2224- test_year ,test_month ,test_day = 2026 ,2 ,25
2225- whitespaces = ('' ,' ' ,'\t ' ,'\r ' ,'\v ' ,'\n ' ,'\f ' )
2226- for ws in (* whitespaces ,'' .join (whitespaces )):
2227- with self .subTest (whitespace = ws ):
2228- self .assertEqual (
2229- self .theclass .strptime (
2230- f'{ test_year :04d} { ws } { test_month :02d} { ws } { test_day :02d} ' ,
2231- "%Y%n%m%n%d"
2232- ),
2233- self .theclass (test_year ,test_month ,test_day )
2234- )
2235-
2210+ def test_strptime_n_and_t_format (self ):
2211+ year , month , day = 2026 , 2 , 20
2212+ whitespaces = ('' , ' ' , '\t ' , '\r ' , '\v ' , '\n ' , '\f ' )
2213+ for fd in ('n' , 't' ):
2214+ for ws in (* whitespaces , '' .join (whitespaces )):
2215+ with self .subTest (format_descriptor = fd , whitespace = ws ):
2216+ self .assertEqual (
2217+ self .theclass .strptime (
2218+ f"{ year :04d} { ws } { month :02d} { ws } { day :02d} " ,
2219+ f"%Y%{ fd } %m%{ fd } %d"
2220+ ),
2221+ self .theclass (year , month , day )
2222+ )
22362223
22372224#############################################################################
22382225# datetime tests
0 commit comments