@@ -290,7 +290,7 @@ def test_strptime_exception_context(self):
290290 # additional check for IndexError branch (issue #19545)
291291 with self .assertRaises (ValueError ) as e :
292292 _strptime ._strptime_time ('19' , '%Y %' )
293- self .assertIs (e .exception .__suppress_context__ , True )
293+ self .assertIsNone (e .exception .__context__ )
294294
295295 def test_unconverteddata (self ):
296296 # Check ValueError is raised when there is unconverted data
@@ -483,12 +483,14 @@ def test_bad_timezone(self):
483483 # id_ID, ms_MY.
484484 # * Year is not included: ha_NG.
485485 # * Use non-Gregorian calendar: lo_LA, thai, th_TH.
486+ # On Windows: ar_IN, ar_SA, fa_IR, ps_AF.
486487 #
487488 # BUG: Generates regexp that does not match the current date and time
488- # for az_IR, fa_IR, lzh_TW, my_MM, or_IN, shn_MM .
489+ # for lzh_TW.
489490 @run_with_locales ('LC_TIME' , 'C' , 'en_US' , 'fr_FR' , 'de_DE' , 'ja_JP' ,
490491 'he_IL' , 'eu_ES' , 'ar_AE' , 'mfe_MU' , 'yo_NG' ,
491- 'csb_PL' , 'br_FR' , 'gez_ET' , 'brx_IN' )
492+ 'csb_PL' , 'br_FR' , 'gez_ET' , 'brx_IN' ,
493+ 'my_MM' , 'or_IN' , 'shn_MM' , 'az_IR' )
492494 def test_date_time_locale (self ):
493495 # Test %c directive
494496 loc = locale .getlocale (locale .LC_TIME )[0 ]
@@ -510,20 +512,23 @@ def test_date_time_locale(self):
510512 self .roundtrip ('%c' , slice (0 , 6 ), time .localtime (now - 366 * 24 * 3600 ))
511513
512514 # NB: Dates before 1969 do not roundtrip on some locales:
513- # bo_CN, bo_IN, dz_BT, eu_ES, eu_FR.
515+ # az_IR, bo_CN, bo_IN, dz_BT, eu_ES, eu_FR, fa_IR, or_IN .
514516 @run_with_locales ('LC_TIME' , 'C' , 'en_US' , 'fr_FR' , 'de_DE' , 'ja_JP' ,
515517 'he_IL' , 'ar_AE' , 'mfe_MU' , 'yo_NG' ,
516- 'csb_PL' , 'br_FR' , 'gez_ET' , 'brx_IN' )
518+ 'csb_PL' , 'br_FR' , 'gez_ET' , 'brx_IN' ,
519+ 'my_MM' , 'shn_MM' )
517520 def test_date_time_locale2 (self ):
518521 # Test %c directive
519522 self .roundtrip ('%c' , slice (0 , 6 ), (1900 , 1 , 1 , 0 , 0 , 0 , 0 , 1 , 0 ))
523+ self .roundtrip ('%c' , slice (0 , 6 ), (1800 , 1 , 1 , 0 , 0 , 0 , 0 , 1 , 0 ))
520524
521525 # NB: Does not roundtrip because use non-Gregorian calendar:
522- # lo_LA, thai, th_TH.
526+ # lo_LA, thai, th_TH. On Windows: ar_IN, ar_SA, fa_IR, ps_AF.
523527 # BUG: Generates regexp that does not match the current date
524- # for az_IR, fa_IR, lzh_TW, my_MM, or_IN, shn_MM .
528+ # for lzh_TW.
525529 @run_with_locales ('LC_TIME' , 'C' , 'en_US' , 'fr_FR' , 'de_DE' , 'ja_JP' ,
526- 'he_IL' , 'eu_ES' , 'ar_AE' )
530+ 'he_IL' , 'eu_ES' , 'ar_AE' ,
531+ 'az_IR' , 'my_MM' , 'or_IN' , 'shn_MM' )
527532 def test_date_locale (self ):
528533 # Test %x directive
529534 now = time .time ()
@@ -543,30 +548,39 @@ def test_date_locale(self):
543548 "musl libc issue on Emscripten, bpo-46390"
544549 )
545550 @run_with_locales ('LC_TIME' , 'en_US' , 'fr_FR' , 'de_DE' , 'ja_JP' ,
546- 'eu_ES' , 'ar_AE' )
551+ 'eu_ES' , 'ar_AE' , 'my_MM' , 'shn_MM' )
547552 def test_date_locale2 (self ):
548553 # Test %x directive
549554 self .roundtrip ('%x' , slice (0 , 3 ), (1900 , 1 , 1 , 0 , 0 , 0 , 0 , 1 , 0 ))
555+ self .roundtrip ('%x' , slice (0 , 3 ), (1800 , 1 , 1 , 0 , 0 , 0 , 0 , 1 , 0 ))
550556
551557 # NB: Does not roundtrip in some locales due to the ambiguity of
552558 # the time representation (bugs in locales?):
553559 # * Seconds are not included: bokmal, ff_SN, nb_NO, nn_NO, no_NO,
554560 # norwegian, nynorsk.
555561 # * Hours are in 12-hour notation without AM/PM indication: hy_AM,
556562 # ms_MY, sm_WS.
557- # BUG: Generates regexp that does not match the current time for
558- # aa_DJ, aa_ER, aa_ET, am_ET, az_IR, byn_ER, fa_IR, gez_ER, gez_ET ,
559- # lzh_TW, my_MM, om_ET, om_KE, or_IN, shn_MM, sid_ET, so_DJ, so_ET ,
560- # so_SO, ti_ER, ti_ET, tig_ER, wal_ET.
561- @ run_with_locales ( 'LC_TIME' , 'C' , 'en_US' , 'fr_FR ' , 'de_DE ' , 'ja_JP ' )
563+ # BUG: Generates regexp that does not match the current time for lzh_TW.
564+ @ run_with_locales ( 'LC_TIME' , 'C' , 'en_US' , 'fr_FR' , 'de_DE' , 'ja_JP' ,
565+ 'aa_ET' , 'am_ET' , 'az_IR' , 'byn_ER' , 'fa_IR' , 'gez_ET' ,
566+ 'my_MM' , 'om_ET' , 'or_IN' , 'shn_MM' , 'sid_ET' , 'so_SO' ,
567+ 'ti_ET ' , 'tig_ER ' , 'wal_ET ' )
562568 def test_time_locale (self ):
563569 # Test %X directive
570+ loc = locale .getlocale (locale .LC_TIME )[0 ]
571+ pos = slice (3 , 6 )
572+ if glibc_ver and glibc_ver < (2 , 29 ) and loc in {
573+ 'aa_ET' , 'am_ET' , 'byn_ER' , 'gez_ET' , 'om_ET' ,
574+ 'sid_ET' , 'so_SO' , 'ti_ET' , 'tig_ER' , 'wal_ET' }:
575+ # Hours are in 12-hour notation without AM/PM indication.
576+ # Ignore hours.
577+ pos = slice (4 , 6 )
564578 now = time .time ()
565- self .roundtrip ('%X' , slice ( 3 , 6 ) , time .localtime (now ))
579+ self .roundtrip ('%X' , pos , time .localtime (now ))
566580 # 1 hour 20 minutes 30 seconds ago
567- self .roundtrip ('%X' , slice ( 3 , 6 ) , time .localtime (now - 4830 ))
581+ self .roundtrip ('%X' , pos , time .localtime (now - 4830 ))
568582 # 12 hours ago
569- self .roundtrip ('%X' , slice ( 3 , 6 ) , time .localtime (now - 12 * 3600 ))
583+ self .roundtrip ('%X' , pos , time .localtime (now - 12 * 3600 ))
570584
571585 def test_percent (self ):
572586 # Make sure % signs are handled properly
0 commit comments