bpo-37627: Initialize IDLE Custom Run dialog with previous entries (#14870)

Repeat the command line arguments most recently entered before so the user can edit them.
This commit is contained in:
Ngalim Siregar 2019-07-21 22:37:28 +07:00 committed by Terry Jan Reedy
parent 02c91f59b6
commit 35b87e6001
4 changed files with 22 additions and 10 deletions

View file

@ -12,7 +12,7 @@ HelpSource htests. These are run by running query.py.
from idlelib import query
import unittest
from test.support import requires
from tkinter import Tk
from tkinter import Tk, END
import sys
from unittest import mock
@ -392,10 +392,12 @@ class CustomRunGuiTest(unittest.TestCase):
def test_click_args(self):
root = Tk()
root.withdraw()
dialog = query.CustomRun(root, 'Title', _utest=True)
dialog.entry.insert(0, 'okay')
dialog = query.CustomRun(root, 'Title',
cli_args=['a', 'b=1'], _utest=True)
self.assertEqual(dialog.entry.get(), 'a b=1')
dialog.entry.insert(END, ' c')
dialog.button_ok.invoke()
self.assertEqual(dialog.result, (['okay'], True))
self.assertEqual(dialog.result, (['a', 'b=1', 'c'], True))
root.destroy()