From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Sat, 6 Nov 2021 19:23:28 +0000 (-0700) Subject: bpo-27313: Use non-deprecated methods for tracing (GH-29425) (GH-29451) X-Git-Tag: v3.9.9~13 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=376218e1c65c029c24e45ca408a14f681cf1aeae;p=thirdparty%2FPython%2Fcpython.git bpo-27313: Use non-deprecated methods for tracing (GH-29425) (GH-29451) (cherry picked from commit cc1cbcbb2d75cacc31ff3359d83043bc7bd5a89d) Co-authored-by: Serhiy Storchaka --- diff --git a/Lib/tkinter/test/test_ttk/test_extensions.py b/Lib/tkinter/test/test_ttk/test_extensions.py index 7fc1ebb95c97..1220c4831c52 100644 --- a/Lib/tkinter/test/test_ttk/test_extensions.py +++ b/Lib/tkinter/test/test_ttk/test_extensions.py @@ -307,14 +307,14 @@ class OptionMenuTest(AbstractTkTest, unittest.TestCase): 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()