diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-03-15 02:59:49 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-15 02:59:49 (GMT) |
commit | 6f4df729bd0b01ae1221f0aba8775f4e3da337e9 (patch) | |
tree | 4e5c42f781b5da952bd56273ddfc60b9701df7b8 /Lib/test | |
parent | 95fd2dfd3f3c0e02cb0ecb21e594663a46d8542c (diff) | |
download | cpython-6f4df729bd0b01ae1221f0aba8775f4e3da337e9.zip cpython-6f4df729bd0b01ae1221f0aba8775f4e3da337e9.tar.gz cpython-6f4df729bd0b01ae1221f0aba8775f4e3da337e9.tar.bz2 |
gh-101377: improving test_locale_calendar_formatweekday of calendar (GH-101378)
---------
(cherry picked from commit 5e0865f22eed9f3f3f0e912c4ada196effbd8ce0)
Co-authored-by: Andre Hora <andrehora@users.noreply.github.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_calendar.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/test/test_calendar.py b/Lib/test/test_calendar.py index dc49ac1..de54f5a 100644 --- a/Lib/test/test_calendar.py +++ b/Lib/test/test_calendar.py @@ -568,11 +568,15 @@ class CalendarTestCase(unittest.TestCase): try: # formatweekday uses different day names based on the available width. cal = calendar.LocaleTextCalendar(locale='en_US') + # For really short widths, the abbreviated name is truncated. + self.assertEqual(cal.formatweekday(0, 1), "M") + self.assertEqual(cal.formatweekday(0, 2), "Mo") # For short widths, a centered, abbreviated name is used. + self.assertEqual(cal.formatweekday(0, 3), "Mon") self.assertEqual(cal.formatweekday(0, 5), " Mon ") - # For really short widths, even the abbreviated name is truncated. - self.assertEqual(cal.formatweekday(0, 2), "Mo") + self.assertEqual(cal.formatweekday(0, 8), " Mon ") # For long widths, the full day name is used. + self.assertEqual(cal.formatweekday(0, 9), " Monday ") self.assertEqual(cal.formatweekday(0, 10), " Monday ") except locale.Error: raise unittest.SkipTest('cannot set the en_US locale') |