@@ -292,7 +292,7 @@ def test_strptime_exception_context(self):
292292 # additional check for IndexError branch (issue #19545)
293293 with self .assertRaises (ValueError ) as e :
294294 _strptime ._strptime_time ('19' , '%Y %' )
295- self .assertIs (e .exception .__suppress_context__ , True )
295+ self .assertIsNone (e .exception .__context__ )
296296
297297 def test_unconverteddata (self ):
298298 # Check ValueError is raised when there is unconverted data
@@ -485,12 +485,14 @@ def test_bad_timezone(self):
485485 # id_ID, ms_MY.
486486 # * Year is not included: ha_NG.
487487 # * Use non-Gregorian calendar: lo_LA, thai, th_TH.
488+ # On Windows: ar_IN, ar_SA, fa_IR, ps_AF.
488489 #
489490 # BUG: Generates regexp that does not match the current date and time
490- # for az_IR, fa_IR, lzh_TW, my_MM, or_IN, shn_MM .
491+ # for lzh_TW.
491492 @run_with_locales ('LC_TIME' , 'C' , 'en_US' , 'fr_FR' , 'de_DE' , 'ja_JP' ,
492493 'he_IL' , 'eu_ES' , 'ar_AE' , 'mfe_MU' , 'yo_NG' ,
493- 'csb_PL' , 'br_FR' , 'gez_ET' , 'brx_IN' )
494+ 'csb_PL' , 'br_FR' , 'gez_ET' , 'brx_IN' ,
495+ 'my_MM' , 'or_IN' , 'shn_MM' , 'az_IR' )
494496 def test_date_time_locale (self ):
495497 # Test %c directive
496498 loc = locale .getlocale (locale .LC_TIME )[0 ]
@@ -512,20 +514,23 @@ def test_date_time_locale(self):
512514 self .roundtrip ('%c' , slice (0 , 6 ), time .localtime (now - 366 * 24 * 3600 ))
513515
514516 # NB: Dates before 1969 do not roundtrip on some locales:
515- # bo_CN, bo_IN, dz_BT, eu_ES, eu_FR.
517+ # az_IR, bo_CN, bo_IN, dz_BT, eu_ES, eu_FR, fa_IR, or_IN .
516518 @run_with_locales ('LC_TIME' , 'C' , 'en_US' , 'fr_FR' , 'de_DE' , 'ja_JP' ,
517519 'he_IL' , 'ar_AE' , 'mfe_MU' , 'yo_NG' ,
518- 'csb_PL' , 'br_FR' , 'gez_ET' , 'brx_IN' )
520+ 'csb_PL' , 'br_FR' , 'gez_ET' , 'brx_IN' ,
521+ 'my_MM' , 'shn_MM' )
519522 def test_date_time_locale2 (self ):
520523 # Test %c directive
521524 self .roundtrip ('%c' , slice (0 , 6 ), (1900 , 1 , 1 , 0 , 0 , 0 , 0 , 1 , 0 ))
525+ self .roundtrip ('%c' , slice (0 , 6 ), (1800 , 1 , 1 , 0 , 0 , 0 , 0 , 1 , 0 ))
522526
523527 # NB: Does not roundtrip because use non-Gregorian calendar:
524- # lo_LA, thai, th_TH.
528+ # lo_LA, thai, th_TH. On Windows: ar_IN, ar_SA, fa_IR, ps_AF.
525529 # BUG: Generates regexp that does not match the current date
526- # for az_IR, fa_IR, lzh_TW, my_MM, or_IN, shn_MM .
530+ # for lzh_TW.
527531 @run_with_locales ('LC_TIME' , 'C' , 'en_US' , 'fr_FR' , 'de_DE' , 'ja_JP' ,
528- 'he_IL' , 'eu_ES' , 'ar_AE' )
532+ 'he_IL' , 'eu_ES' , 'ar_AE' ,
533+ 'az_IR' , 'my_MM' , 'or_IN' , 'shn_MM' )
529534 def test_date_locale (self ):
530535 # Test %x directive
531536 now = time .time ()
@@ -545,30 +550,39 @@ def test_date_locale(self):
545550 "musl libc issue on Emscripten, bpo-46390"
546551 )
547552 @run_with_locales ('LC_TIME' , 'en_US' , 'fr_FR' , 'de_DE' , 'ja_JP' ,
548- 'eu_ES' , 'ar_AE' )
553+ 'eu_ES' , 'ar_AE' , 'my_MM' , 'shn_MM' )
549554 def test_date_locale2 (self ):
550555 # Test %x directive
551556 self .roundtrip ('%x' , slice (0 , 3 ), (1900 , 1 , 1 , 0 , 0 , 0 , 0 , 1 , 0 ))
557+ self .roundtrip ('%x' , slice (0 , 3 ), (1800 , 1 , 1 , 0 , 0 , 0 , 0 , 1 , 0 ))
552558
553559 # NB: Does not roundtrip in some locales due to the ambiguity of
554560 # the time representation (bugs in locales?):
555561 # * Seconds are not included: bokmal, ff_SN, nb_NO, nn_NO, no_NO,
556562 # norwegian, nynorsk.
557563 # * Hours are in 12-hour notation without AM/PM indication: hy_AM,
558564 # ms_MY, sm_WS.
559- # BUG: Generates regexp that does not match the current time for
560- # aa_DJ, aa_ER, aa_ET, am_ET, az_IR, byn_ER, fa_IR, gez_ER, gez_ET ,
561- # lzh_TW, my_MM, om_ET, om_KE, or_IN, shn_MM, sid_ET, so_DJ, so_ET ,
562- # so_SO, ti_ER, ti_ET, tig_ER, wal_ET.
563- @ run_with_locales ( 'LC_TIME' , 'C' , 'en_US' , 'fr_FR ' , 'de_DE ' , 'ja_JP ' )
565+ # BUG: Generates regexp that does not match the current time for lzh_TW.
566+ @ run_with_locales ( 'LC_TIME' , 'C' , 'en_US' , 'fr_FR' , 'de_DE' , 'ja_JP' ,
567+ 'aa_ET' , 'am_ET' , 'az_IR' , 'byn_ER' , 'fa_IR' , 'gez_ET' ,
568+ 'my_MM' , 'om_ET' , 'or_IN' , 'shn_MM' , 'sid_ET' , 'so_SO' ,
569+ 'ti_ET ' , 'tig_ER ' , 'wal_ET ' )
564570 def test_time_locale (self ):
565571 # Test %X directive
572+ loc = locale .getlocale (locale .LC_TIME )[0 ]
573+ pos = slice (3 , 6 )
574+ if glibc_ver and glibc_ver < (2 , 29 ) and loc in {
575+ 'aa_ET' , 'am_ET' , 'byn_ER' , 'gez_ET' , 'om_ET' ,
576+ 'sid_ET' , 'so_SO' , 'ti_ET' , 'tig_ER' , 'wal_ET' }:
577+ # Hours are in 12-hour notation without AM/PM indication.
578+ # Ignore hours.
579+ pos = slice (4 , 6 )
566580 now = time .time ()
567- self .roundtrip ('%X' , slice ( 3 , 6 ) , time .localtime (now ))
581+ self .roundtrip ('%X' , pos , time .localtime (now ))
568582 # 1 hour 20 minutes 30 seconds ago
569- self .roundtrip ('%X' , slice ( 3 , 6 ) , time .localtime (now - 4830 ))
583+ self .roundtrip ('%X' , pos , time .localtime (now - 4830 ))
570584 # 12 hours ago
571- self .roundtrip ('%X' , slice ( 3 , 6 ) , time .localtime (now - 12 * 3600 ))
585+ self .roundtrip ('%X' , pos , time .localtime (now - 12 * 3600 ))
572586
573587 def test_percent (self ):
574588 # Make sure % signs are handled properly
0 commit comments