Commit 2f26c224 authored by Serhiy Storchaka's avatar Serhiy Storchaka

tkinter.Text.debug() now always returns 0/1.

Fixed a regression inroduced in issue #6157.
parent 02d5db27
...@@ -3002,7 +3002,7 @@ class Text(Widget, XView, YView): ...@@ -3002,7 +3002,7 @@ class Text(Widget, XView, YView):
"""Turn on the internal consistency checks of the B-Tree inside the text """Turn on the internal consistency checks of the B-Tree inside the text
widget according to BOOLEAN.""" widget according to BOOLEAN."""
if boolean is None: if boolean is None:
return self.tk.call(self._w, 'debug') return self.tk.getboolean(self.tk.call(self._w, 'debug'))
self.tk.call(self._w, 'debug', boolean) self.tk.call(self._w, 'debug', boolean)
def delete(self, index1, index2=None): def delete(self, index1, index2=None):
"""Delete the characters between INDEX1 and INDEX2 (not included).""" """Delete the characters between INDEX1 and INDEX2 (not included)."""
......
...@@ -16,13 +16,12 @@ class TextTest(unittest.TestCase): ...@@ -16,13 +16,12 @@ class TextTest(unittest.TestCase):
def test_debug(self): def test_debug(self):
text = self.text text = self.text
wantobjects = self.root.wantobjects()
olddebug = text.debug() olddebug = text.debug()
try: try:
text.debug(0) text.debug(0)
self.assertEqual(text.debug(), 0 if wantobjects else '0') self.assertEqual(text.debug(), 0)
text.debug(1) text.debug(1)
self.assertEqual(text.debug(), 1 if wantobjects else '1') self.assertEqual(text.debug(), 1)
finally: finally:
text.debug(olddebug) text.debug(olddebug)
self.assertEqual(text.debug(), olddebug) self.assertEqual(text.debug(), olddebug)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment