diff options
author | Hugo van Kemenade <hugovk@users.noreply.github.com> | 2022-06-07 08:44:29 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-07 08:44:29 (GMT) |
commit | f0d0be3493fc5855eccfe0fbb3f25bf12760041f (patch) | |
tree | 3f8f2ea0d2067a19552a1f1654bbc2595300e825 | |
parent | 1b7480399162b5b469bb9533f5ceda53d16f6586 (diff) | |
download | cpython-f0d0be3493fc5855eccfe0fbb3f25bf12760041f.zip cpython-f0d0be3493fc5855eccfe0fbb3f25bf12760041f.tar.gz cpython-f0d0be3493fc5855eccfe0fbb3f25bf12760041f.tar.bz2 |
gh-57539: Increase calendar test coverage (GH-93468)
Co-authored-by: Sean Fleming
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
-rw-r--r-- | Lib/test/test_calendar.py | 13 | ||||
-rw-r--r-- | Misc/ACKS | 1 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Tests/2022-06-03-16-26-04.gh-issue-57539.HxWgYO.rst | 1 |
3 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_calendar.py b/Lib/test/test_calendar.py index f76cbc9..3d9dcf1 100644 --- a/Lib/test/test_calendar.py +++ b/Lib/test/test_calendar.py @@ -564,6 +564,19 @@ class CalendarTestCase(unittest.TestCase): new_october = calendar.TextCalendar().formatmonthname(2010, 10, 10) self.assertEqual(old_october, new_october) + def test_locale_calendar_formatweekday(self): + try: + # formatweekday uses different day names based on the available width. + cal = calendar.LocaleTextCalendar(locale='en_US') + # For short widths, a centered, abbreviated name is used. + self.assertEqual(cal.formatweekday(0, 5), " Mon ") + # For really short widths, even the abbreviated name is truncated. + self.assertEqual(cal.formatweekday(0, 2), "Mo") + # For long widths, the full day name is used. + self.assertEqual(cal.formatweekday(0, 10), " Monday ") + except locale.Error: + raise unittest.SkipTest('cannot set the en_US locale') + def test_locale_html_calendar_custom_css_class_month_name(self): try: cal = calendar.LocaleHTMLCalendar(locale='') @@ -548,6 +548,7 @@ Nils Fischbeck Frederik Fix Tom Flanagan Matt Fleming +Sean Fleming Hernán Martínez Foffani Benjamin Fogle Artem Fokin diff --git a/Misc/NEWS.d/next/Tests/2022-06-03-16-26-04.gh-issue-57539.HxWgYO.rst b/Misc/NEWS.d/next/Tests/2022-06-03-16-26-04.gh-issue-57539.HxWgYO.rst new file mode 100644 index 0000000..0734b59 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2022-06-03-16-26-04.gh-issue-57539.HxWgYO.rst @@ -0,0 +1 @@ +Increase calendar test coverage for :meth:`calendar.LocaleTextCalendar.formatweekday`. |