From c753ae21b3e6c00f4c51c051f3bcf43b1cc0a9b1 Mon Sep 17 00:00:00 2001 From: Christopher Chavez Date: Sun, 14 May 2023 21:22:45 -0500 Subject: [PATCH 1/3] gh-104494: Update Tkinter tests for Tk 8.7 errors --- Lib/test/test_tkinter/test_geometry_managers.py | 9 +++++---- .../Tests/2023-05-15-02-22-44.gh-issue-104494.Bkrbfn.rst | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 Misc/NEWS.d/next/Tests/2023-05-15-02-22-44.gh-issue-104494.Bkrbfn.rst diff --git a/Lib/test/test_tkinter/test_geometry_managers.py b/Lib/test/test_tkinter/test_geometry_managers.py index 3663048a145ab1..18be8392692f4e 100644 --- a/Lib/test/test_tkinter/test_geometry_managers.py +++ b/Lib/test/test_tkinter/test_geometry_managers.py @@ -108,8 +108,8 @@ def test_pack_configure_in(self): a.pack_configure(in_=c) self.assertEqual(pack.pack_slaves(), [b, c, d]) self.assertEqual(c.pack_slaves(), [a]) - with self.assertRaisesRegex(TclError, - 'can\'t pack %s inside itself' % (a,)): + with self.assertRaisesRegex(TclError, "can't pack " + '"?%s"? inside itself' % (a,)): a.pack_configure(in_=a) with self.assertRaisesRegex(TclError, 'bad window path name ".foo"'): a.pack_configure(in_='.foo') @@ -292,8 +292,9 @@ def create2(self): def test_place_configure_in(self): t, f, f2 = self.create2() self.assertEqual(f2.winfo_manager(), '') - with self.assertRaisesRegex(TclError, "can't place %s relative to " - "itself" % re.escape(str(f2))): + with self.assertRaisesRegex(TclError, "can't place " + '"?%s"? relative to itself' % + re.escape(str(f2))): f2.place_configure(in_=f2) self.assertEqual(f2.winfo_manager(), '') with self.assertRaisesRegex(TclError, 'bad window path name'): diff --git a/Misc/NEWS.d/next/Tests/2023-05-15-02-22-44.gh-issue-104494.Bkrbfn.rst b/Misc/NEWS.d/next/Tests/2023-05-15-02-22-44.gh-issue-104494.Bkrbfn.rst new file mode 100644 index 00000000000000..406b49b4724f7a --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2023-05-15-02-22-44.gh-issue-104494.Bkrbfn.rst @@ -0,0 +1,2 @@ +Update test_pack_configure_in and test_place_configure_in +for changes to error message formatting in Tk 8.7. From 56f2b32b5181f8216fd3d16bf555c04c848b2c67 Mon Sep 17 00:00:00 2001 From: Christopher Chavez Date: Sun, 14 May 2023 23:38:30 -0500 Subject: [PATCH 2/3] Apply suggestions from code review Co-authored-by: Terry Jan Reedy --- Lib/test/test_tkinter/test_geometry_managers.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Lib/test/test_tkinter/test_geometry_managers.py b/Lib/test/test_tkinter/test_geometry_managers.py index 18be8392692f4e..59fe592b492adc 100644 --- a/Lib/test/test_tkinter/test_geometry_managers.py +++ b/Lib/test/test_tkinter/test_geometry_managers.py @@ -108,8 +108,8 @@ def test_pack_configure_in(self): a.pack_configure(in_=c) self.assertEqual(pack.pack_slaves(), [b, c, d]) self.assertEqual(c.pack_slaves(), [a]) - with self.assertRaisesRegex(TclError, "can't pack " - '"?%s"? inside itself' % (a,)): + with self.assertRaisesRegex( + TclError, """can't pack "?%s"? inside itself""" % (a,)): a.pack_configure(in_=a) with self.assertRaisesRegex(TclError, 'bad window path name ".foo"'): a.pack_configure(in_='.foo') @@ -292,9 +292,10 @@ def create2(self): def test_place_configure_in(self): t, f, f2 = self.create2() self.assertEqual(f2.winfo_manager(), '') - with self.assertRaisesRegex(TclError, "can't place " - '"?%s"? relative to itself' % - re.escape(str(f2))): + with self.assertRaisesRegex( + TclError, + """can't place "?%s"? relative to itself""" + % re.escape(str(f2))): f2.place_configure(in_=f2) self.assertEqual(f2.winfo_manager(), '') with self.assertRaisesRegex(TclError, 'bad window path name'): From 96b52430e79f0da40af4344127a6653e82fba6e6 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Mon, 15 May 2023 02:56:35 -0400 Subject: [PATCH 3/3] Update Misc/NEWS.d/next/Tests/2023-05-15-02-22-44.gh-issue-104494.Bkrbfn.rst Co-authored-by: Erlend E. Aasland --- .../next/Tests/2023-05-15-02-22-44.gh-issue-104494.Bkrbfn.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Tests/2023-05-15-02-22-44.gh-issue-104494.Bkrbfn.rst b/Misc/NEWS.d/next/Tests/2023-05-15-02-22-44.gh-issue-104494.Bkrbfn.rst index 406b49b4724f7a..a320c48428b58b 100644 --- a/Misc/NEWS.d/next/Tests/2023-05-15-02-22-44.gh-issue-104494.Bkrbfn.rst +++ b/Misc/NEWS.d/next/Tests/2023-05-15-02-22-44.gh-issue-104494.Bkrbfn.rst @@ -1,2 +1,2 @@ -Update test_pack_configure_in and test_place_configure_in +Update ``test_pack_configure_in`` and ``test_place_configure_in`` for changes to error message formatting in Tk 8.7.