[Python-checkins] bpo-27313: Use non-deprecated methods for tracing (GH-29425) (GH-29451)

ambv webhook-mailer at python.org
Sat Nov 6 15:23:32 EDT 2021


https://github.com/python/cpython/commit/376218e1c65c029c24e45ca408a14f681cf1aeae
commit: 376218e1c65c029c24e45ca408a14f681cf1aeae
branch: 3.9
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: ambv <lukasz at langa.pl>
date: 2021-11-06T20:23:28+01:00
summary:

bpo-27313: Use non-deprecated methods for tracing (GH-29425) (GH-29451)

(cherry picked from commit cc1cbcbb2d75cacc31ff3359d83043bc7bd5a89d)

Co-authored-by: Serhiy Storchaka <storchaka at gmail.com>

files:
M Lib/tkinter/test/test_ttk/test_extensions.py

diff --git a/Lib/tkinter/test/test_ttk/test_extensions.py b/Lib/tkinter/test/test_ttk/test_extensions.py
index 7fc1ebb95c970..1220c4831c52f 100644
--- a/Lib/tkinter/test/test_ttk/test_extensions.py
+++ b/Lib/tkinter/test/test_ttk/test_extensions.py
@@ -307,14 +307,14 @@ def test_trace_variable(self):
         items = ('a', 'b', 'c')
         textvar = tkinter.StringVar(self.root)
         def cb_test(*args):
-            self.assertEqual(textvar.get(), items[1])
-            success.append(True)
+            success.append(textvar.get())
         optmenu = ttk.OptionMenu(self.root, textvar, "a", *items)
         optmenu.pack()
-        cb_name = textvar.trace("w", cb_test)
+        cb_name = textvar.trace_add("write", cb_test)
         optmenu['menu'].invoke(1)
-        self.assertEqual(success, [True])
-        textvar.trace_vdelete("w", cb_name)
+        self.assertEqual(success, ['b'])
+        self.assertEqual(textvar.get(), 'b')
+        textvar.trace_remove("write", cb_name)
         optmenu.destroy()
 
 



More information about the Python-checkins mailing list