mirror of
https://github.com/python/cpython.git
synced 2025-10-07 23:51:16 +00:00
[3.6] bpo-30495: IDLE: improve textview with docstrings, PEP8 names, more tests. (GH-2283) (#2496)
Split TextViewer class into ViewWindow, ViewFrame, and TextFrame classes so that instances
of the latter two can be placed with other widgets within a multiframe window.
Patch by Cheryl Sabella.
(cherry picked from commit 42bc8be
)
This commit is contained in:
parent
1d56ed5210
commit
6f31717c47
6 changed files with 141 additions and 100 deletions
|
@ -50,19 +50,17 @@ class LiveDialogTest(unittest.TestCase):
|
|||
def test_printer_buttons(self):
|
||||
"""Test buttons whose commands use printer function."""
|
||||
dialog = self.dialog
|
||||
button_sources = [(self.dialog.py_license, license),
|
||||
(self.dialog.py_copyright, copyright),
|
||||
(self.dialog.py_credits, credits)]
|
||||
button_sources = [(dialog.py_license, license),
|
||||
(dialog.py_copyright, copyright),
|
||||
(dialog.py_credits, credits)]
|
||||
|
||||
for button, printer in button_sources:
|
||||
printer._Printer__setup()
|
||||
button.invoke()
|
||||
get = dialog._current_textview.viewframe.textframe.text.get
|
||||
self.assertEqual(printer._Printer__lines[0], get('1.0', '1.end'))
|
||||
self.assertEqual(
|
||||
printer._Printer__lines[0],
|
||||
dialog._current_textview.text.get('1.0', '1.end'))
|
||||
self.assertEqual(
|
||||
printer._Printer__lines[1],
|
||||
dialog._current_textview.text.get('2.0', '2.end'))
|
||||
printer._Printer__lines[1], get('2.0', '2.end'))
|
||||
dialog._current_textview.destroy()
|
||||
|
||||
def test_file_buttons(self):
|
||||
|
@ -75,14 +73,11 @@ class LiveDialogTest(unittest.TestCase):
|
|||
for button, filename in button_sources:
|
||||
button.invoke()
|
||||
fn = findfile(filename, subdir='idlelib')
|
||||
get = dialog._current_textview.viewframe.textframe.text.get
|
||||
with open(fn) as f:
|
||||
self.assertEqual(
|
||||
f.readline().strip(),
|
||||
dialog._current_textview.text.get('1.0', '1.end'))
|
||||
self.assertEqual(f.readline().strip(), get('1.0', '1.end'))
|
||||
f.readline()
|
||||
self.assertEqual(
|
||||
f.readline().strip(),
|
||||
dialog._current_textview.text.get('3.0', '3.end'))
|
||||
self.assertEqual(f.readline().strip(), get('3.0', '3.end'))
|
||||
dialog._current_textview.destroy()
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue