◐ Shell
reader mode source ↗
Skip to content
Closed
Changes from all commits
File filter
Conversations
Jump to
Diff view
Apply and reload
Show whitespace
Diff view
Apply and reload
27 changes: 22 additions & 5 deletions Lib/idlelib/idle_test/test_squeezer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from collections import namedtuple
from textwrap import dedent
from tkinter import Text, Tk
import unittest
from unittest.mock import Mock, NonCallableMagicMock, patch, sentinel, ANY
from test.support import requires
Expand All @@ -18,6 +19,15 @@

SENTINEL_VALUE = sentinel.SENTINEL_VALUE


def get_test_tk_root(test_instance):
"""Helper for tests: Create a root Tk object."""
Expand Down Expand Up @@ -82,6 +92,15 @@ def test_several_lines_different_lengths(self):

class SqueezerTest(unittest.TestCase):
"""Tests for the Squeezer class."""
def tearDown(self):
# Clean up the Squeezer class's reference to its instance,
# to avoid side-effects from one test case upon another.
Expand Down Expand Up @@ -114,7 +133,7 @@ def make_text_widget(self, root=None):
if root is None:
root = get_test_tk_root(self)
text_widget = Text(root)
text_widget["font"] = ('Courier', 10)
text_widget.mark_set("iomark", "1.0")
return text_widget

Expand Down Expand Up @@ -300,16 +319,14 @@ def test_reload(self):
orig_auto_squeeze_min_lines = squeezer.auto_squeeze_min_lines

# Increase both font size and auto-squeeze-min-lines.
text_widget["font"] = ('Courier', 20)
new_auto_squeeze_min_lines = orig_auto_squeeze_min_lines + 10
self.set_idleconf_option_with_cleanup(
'main', 'PyShell', 'auto-squeeze-min-lines',
str(new_auto_squeeze_min_lines))

Squeezer.reload()
# The following failed on Gentoo buildbots. Issue title will be
# IDLE: Fix squeezer test_reload.
#self.assertGreater(squeezer.zero_char_width, orig_zero_char_width)
self.assertEqual(squeezer.auto_squeeze_min_lines,
new_auto_squeeze_min_lines)

Expand Down
Toggle all file notes Toggle all file annotations