mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-38041: Refine IDLE Shell restart lines. (GH-15709)
Restart lines now always start with '=' and never end with ' ' and fill the width of the window unless that would require ending with ' ', which could be wrapped by itself and possible confusing the user.
This commit is contained in:
parent
74b662cf20
commit
38da805d56
4 changed files with 44 additions and 3 deletions
|
@ -7,6 +7,28 @@ from test.support import requires
|
|||
from tkinter import Tk
|
||||
|
||||
|
||||
class FunctionTest(unittest.TestCase):
|
||||
# Test stand-alone module level non-gui functions.
|
||||
|
||||
def test_restart_line_wide(self):
|
||||
eq = self.assertEqual
|
||||
for file, mul, extra in (('', 22, ''), ('finame', 21, '=')):
|
||||
width = 60
|
||||
bar = mul * '='
|
||||
with self.subTest(file=file, bar=bar):
|
||||
file = file or 'Shell'
|
||||
line = pyshell.restart_line(width, file)
|
||||
eq(len(line), width)
|
||||
eq(line, f"{bar+extra} RESTART: {file} {bar}")
|
||||
|
||||
def test_restart_line_narrow(self):
|
||||
expect, taglen = "= RESTART: Shell", 16
|
||||
for width in (taglen-1, taglen, taglen+1):
|
||||
with self.subTest(width=width):
|
||||
self.assertEqual(pyshell.restart_line(width, ''), expect)
|
||||
self.assertEqual(pyshell.restart_line(taglen+2, ''), expect+' =')
|
||||
|
||||
|
||||
class PyShellFileListTest(unittest.TestCase):
|
||||
|
||||
@classmethod
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue