You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Attached is the 3.4 code I plan to commit after a trivial 2.7 backport.
In the existing htest, 'global previous_tcl_fcn' is unnecessary because of Python's late binding of function locals. No forward definitions are needed. Already deleted in the first patch.
Adding this test:
def test_unregister_no_attribute(self):
del self.text.insert
self.assertEqual(self.redir.unregister('insert'), self.func)
revealed that this code in .unregister
if hasattr(self.widget, operation):
delattr(self.widget, operation)
is buggy because hasattr looks up the class tree for an attribute whereas delattr does not. Hence the former can be true, and will be after text.insert in deleted to unmask Text.insert, while delattr raises AttributeError. The if check is useless, and replaced by 'try...' in the new patch.
I modified a few tests and added a few more. Coverage is now 100%.
Activity
SaimadhavHeblikar commentedon Jul 8, 2014
Attached is unittest for idlelib.WidgetRedirector
2.7 version will be uploaded once this is OK.
python-dev commentedon Jul 10, 2014
New changeset 5af194064f96 by Terry Jan Reedy in branch '2.7':
Issue bpo-21940: add docstrings to idlelib.WidgetRedirector.
http://hg.python.org/cpython/rev/5af194064f96
New changeset 220d5fdbe22e by Terry Jan Reedy in branch '3.4':
Issue bpo-21940: add docstrings to idlelib.WidgetRedirector.
http://hg.python.org/cpython/rev/220d5fdbe22e
terryjreedy commentedon Jul 10, 2014
Attached is the 3.4 code I plan to commit after a trivial 2.7 backport.
In the existing htest, 'global previous_tcl_fcn' is unnecessary because of Python's late binding of function locals. No forward definitions are needed. Already deleted in the first patch.
Adding this test:
def test_unregister_no_attribute(self):
del self.text.insert
self.assertEqual(self.redir.unregister('insert'), self.func)
revealed that this code in .unregister
if hasattr(self.widget, operation):
delattr(self.widget, operation)
is buggy because hasattr looks up the class tree for an attribute whereas delattr does not. Hence the former can be true, and will be after text.insert in deleted to unmask Text.insert, while delattr raises AttributeError. The if check is useless, and replaced by 'try...' in the new patch.
I modified a few tests and added a few more. Coverage is now 100%.
python-dev commentedon Jul 11, 2014
New changeset 53d0776aab53 by Terry Jan Reedy in branch '2.7':
bpo-21940: Add unittest for WidgetRedirector. Initial patch by Saimadhav Heblikar.
http://hg.python.org/cpython/rev/53d0776aab53
New changeset edf2ae293d70 by Terry Jan Reedy in branch '3.4':
bpo-21940: Add unittest for WidgetRedirector. Initial patch by Saimadhav Heblikar.
http://hg.python.org/cpython/rev/edf2ae293d70