]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-104494: Update certain Tkinter pack/place tests for Tk 8.7 errors (#104495)
authorChristopher Chavez <chrischavez@gmx.us>
Mon, 15 May 2023 08:54:41 +0000 (03:54 -0500)
committerGitHub <noreply@github.com>
Mon, 15 May 2023 08:54:41 +0000 (04:54 -0400)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Lib/test/test_tkinter/test_geometry_managers.py
Misc/NEWS.d/next/Tests/2023-05-15-02-22-44.gh-issue-104494.Bkrbfn.rst [new file with mode: 0644]

index 3663048a145ab10bbdfb04b462305b924bf46b2e..59fe592b492adc30af1d37fbd16de1ce027bcf1c 100644 (file)
@@ -108,8 +108,8 @@ class PackTest(AbstractWidgetTest, unittest.TestCase):
         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,10 @@ class PlaceTest(AbstractWidgetTest, unittest.TestCase):
     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 (file)
index 0000000..a320c48
--- /dev/null
@@ -0,0 +1,2 @@
+Update ``test_pack_configure_in`` and ``test_place_configure_in``
+for changes to error message formatting in Tk 8.7.