diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2024-10-15 08:05:40 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-15 08:05:40 (GMT) |
commit | 92af191a6a5f266b71373f5374ca0c9c522d62d9 (patch) | |
tree | 85bba4479a3d60a3122093b34c65e1ac587eaaf7 | |
parent | 66064c342c6fb54b443aae8ccf8db74bb9d8bc50 (diff) | |
download | cpython-92af191a6a5f266b71373f5374ca0c9c522d62d9.zip cpython-92af191a6a5f266b71373f5374ca0c9c522d62d9.tar.gz cpython-92af191a6a5f266b71373f5374ca0c9c522d62d9.tar.bz2 |
gh-53203: Fix strptime() tests for %X on glibc < 2.29 (#125469)
-rw-r--r-- | Lib/test/test_strptime.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/Lib/test/test_strptime.py b/Lib/test/test_strptime.py index 12366b0..09f6f65 100644 --- a/Lib/test/test_strptime.py +++ b/Lib/test/test_strptime.py @@ -569,12 +569,20 @@ class StrptimeTests(unittest.TestCase): 'ti_ET', 'tig_ER', 'wal_ET') def test_time_locale(self): # Test %X directive + loc = locale.getlocale(locale.LC_TIME)[0] + pos = slice(3, 6) + if glibc_ver and glibc_ver < (2, 29) and loc in { + 'aa_ET', 'am_ET', 'byn_ER', 'gez_ET', 'om_ET', + 'sid_ET', 'so_SO', 'ti_ET', 'tig_ER', 'wal_ET'}: + # Hours are in 12-hour notation without AM/PM indication. + # Ignore hours. + pos = slice(4, 6) now = time.time() - self.roundtrip('%X', slice(3, 6), time.localtime(now)) + self.roundtrip('%X', pos, time.localtime(now)) # 1 hour 20 minutes 30 seconds ago - self.roundtrip('%X', slice(3, 6), time.localtime(now - 4830)) + self.roundtrip('%X', pos, time.localtime(now - 4830)) # 12 hours ago - self.roundtrip('%X', slice(3, 6), time.localtime(now - 12*3600)) + self.roundtrip('%X', pos, time.localtime(now - 12*3600)) def test_percent(self): # Make sure % signs are handled properly |