]> granicus.if.org Git - python/commitdiff
Issue #22115: Updated Misc/NEWS.
authorSerhiy Storchaka <storchaka@gmail.com>
Sun, 26 Jun 2016 14:47:46 +0000 (17:47 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Sun, 26 Jun 2016 14:47:46 +0000 (17:47 +0300)
1  2 
Lib/tkinter/test/test_tkinter/test_variables.py
Misc/NEWS

index c5292591903d033c88529ec558fb3e27f45afb13,1f74453cea684702eaac25268f505c671e2c8b51..44858173c43f7c9d1333fde032efaf0e9f065753
@@@ -87,9 -87,8 +87,9 @@@ class TestVariable(TestBase)
          v.set("value")
          self.assertTrue(v.side_effect)
  
 -    def test_trace(self):
 +    def test_trace_old(self):
 +        # Old interface
-         v = Var(self.root)
+         v = Variable(self.root)
          vname = str(v)
          trace = []
          def read_tracer(*args):
          gc.collect()
          self.assertEqual(trace, [('write', vname, '', 'u')])
  
-         v = Var(self.root)
 +    def test_trace(self):
++        v = Variable(self.root)
 +        vname = str(v)
 +        trace = []
 +        def read_tracer(*args):
 +            trace.append(('read',) + args)
 +        def write_tracer(*args):
 +            trace.append(('write',) + args)
 +        tr1 = v.trace_add('read', read_tracer)
 +        tr2 = v.trace_add(['write', 'unset'], write_tracer)
 +        self.assertEqual(sorted(v.trace_info()), [
 +                         (('read',), tr1),
 +                         (('write', 'unset'), tr2)])
 +        self.assertEqual(trace, [])
 +
 +        v.set('spam')
 +        self.assertEqual(trace, [('write', vname, '', 'write')])
 +
 +        trace = []
 +        v.get()
 +        self.assertEqual(trace, [('read', vname, '', 'read')])
 +
 +        trace = []
 +        info = sorted(v.trace_info())
 +        v.trace_remove('write', tr1)  # Wrong mode
 +        self.assertEqual(sorted(v.trace_info()), info)
 +        with self.assertRaises(TclError):
 +            v.trace_remove('read', 'spam')  # Wrong command name
 +        self.assertEqual(sorted(v.trace_info()), info)
 +        v.get()
 +        self.assertEqual(trace, [('read', vname, '', 'read')])
 +
 +        trace = []
 +        v.trace_remove('read', tr1)
 +        self.assertEqual(v.trace_info(), [(('write', 'unset'), tr2)])
 +        v.get()
 +        self.assertEqual(trace, [])
 +
 +        trace = []
 +        del write_tracer
 +        gc.collect()
 +        v.set('eggs')
 +        self.assertEqual(trace, [('write', vname, '', 'write')])
 +
 +        trace = []
 +        del v
 +        gc.collect()
 +        self.assertEqual(trace, [('write', vname, '', 'unset')])
 +
  
  class TestStringVar(TestBase):
  
diff --cc Misc/NEWS
index cd6aa9308dcfb811da82aaef5022361baa3c424c,cc53bcd7d8016ee9fc08093a8a1a9ede73e5fe0d..1e61eca631243088a8f671fe67bfebf81980915f
+++ b/Misc/NEWS
@@@ -10,28 -13,13 +10,30 @@@ What's New in Python 3.6.0 alpha 
  Library
  -------
  
 -- Issue #22115: Fixed tracing Tkinter variables: trace_vdelete() with wrong
 -  mode no longer break tracing, trace_vinfo() now always returns a list of
 -  pairs of strings, tracing in the "u" mode now works.
 +- Issue #22115: Added methods trace_add, trace_remove and trace_info in the
 +  tkinter.Variable class.  They replace old methods trace_variable, trace,
 +  trace_vdelete and trace_vinfo that use obsolete Tcl commands and might
-   not work in future versions of Tcl.
++  not work in future versions of Tcl.  Fixed old tracing methods:
++  trace_vdelete() with wrong mode no longer break tracing, trace_vinfo() now
++  always returns a list of pairs of strings, tracing in the "u" mode now works.
 +
 +- Issue #26243: Only the level argument to zlib.compress() is keyword argument
 +  now.  The first argument is positional-only.
  
 -- Fix a scoping issue in importlib.util.LazyLoader which triggered an
 -  UnboundLocalError when lazy-loading a module that was already put into
 -  sys.modules.
 +- Issue #27038: Expose the DirEntry type as os.DirEntry. Code patch by
 +  Jelle Zijlstra.
 +
 +- Issue #27186: Update os.fspath()/PyOS_FSPath() to check the return value of
 +  __fspath__() to be either str or bytes.
 +
 +- Issue #18726: All optional parameters of the dump(), dumps(),
 +  load() and loads() functions and JSONEncoder and JSONDecoder class
 +  constructors in the json module are now keyword-only.
 +
 +- Issue #27319: Methods selection_set(), selection_add(), selection_remove()
 +  and selection_toggle() of ttk.TreeView now allow passing multiple items as
 +  multiple arguments instead of passing them as a tuple.  Deprecated
 +  undocumented ability of calling the selection() method with arguments.
  
  - Issue #27079: Fixed curses.ascii functions isblank(), iscntrl() and ispunct().