From 7cb0da6d40bbe4e316d0b373b0501dee0e4caea4 Mon Sep 17 00:00:00 2001 From: Andre Hora Date: Fri, 27 Jan 2023 14:05:22 -0300 Subject: [PATCH 1/3] improving test test_locale_calendar_formatweekday of calendar --- Lib/test/test_calendar.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_calendar.py b/Lib/test/test_calendar.py index 3d9dcf12f2dad8..f9ae78e712cd38 100644 --- a/Lib/test/test_calendar.py +++ b/Lib/test/test_calendar.py @@ -568,11 +568,18 @@ def test_locale_calendar_formatweekday(self): 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, 4), "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, 6), " Mon ") + self.assertEqual(cal.formatweekday(0, 7), " Mon ") + 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') From c01cec3094f5f7338475c8d91bd12895b743de17 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Fri, 27 Jan 2023 18:10:41 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Tests/2023-01-27-18-10-40.gh-issue-101377.IJGpqh.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Tests/2023-01-27-18-10-40.gh-issue-101377.IJGpqh.rst diff --git a/Misc/NEWS.d/next/Tests/2023-01-27-18-10-40.gh-issue-101377.IJGpqh.rst b/Misc/NEWS.d/next/Tests/2023-01-27-18-10-40.gh-issue-101377.IJGpqh.rst new file mode 100644 index 00000000000000..a9c19ce060e3ab --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2023-01-27-18-10-40.gh-issue-101377.IJGpqh.rst @@ -0,0 +1 @@ +Improved test_locale_calendar_formatweekday of calendar. From 7b665ff87b8f917810b91b6c27932bf5140318cc Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Fri, 24 Feb 2023 01:32:03 -0500 Subject: [PATCH 3/3] Update test_calendar.py Remove a few cases that I considered excessive. --- Lib/test/test_calendar.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/Lib/test/test_calendar.py b/Lib/test/test_calendar.py index f9ae78e712cd38..ccfbeede0be949 100644 --- a/Lib/test/test_calendar.py +++ b/Lib/test/test_calendar.py @@ -573,10 +573,7 @@ def test_locale_calendar_formatweekday(self): 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, 4), "Mon ") self.assertEqual(cal.formatweekday(0, 5), " Mon ") - self.assertEqual(cal.formatweekday(0, 6), " Mon ") - self.assertEqual(cal.formatweekday(0, 7), " Mon ") self.assertEqual(cal.formatweekday(0, 8), " Mon ") # For long widths, the full day name is used. self.assertEqual(cal.formatweekday(0, 9), " Monday ")