summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/idle_test
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2022-08-02 04:10:39 (GMT)
committerGitHub <noreply@github.com>2022-08-02 04:10:39 (GMT)
commitb85411fc5e9e223a6bd44f89f674ee3b2e29b99e (patch)
tree961d247ab3c6a0cee627bb842f03c60f94eec3eb /Lib/idlelib/idle_test
parentd2c1a9c76c001b18c14e50779b0ee41ea4ccf0b3 (diff)
downloadcpython-b85411fc5e9e223a6bd44f89f674ee3b2e29b99e.zip
cpython-b85411fc5e9e223a6bd44f89f674ee3b2e29b99e.tar.gz
cpython-b85411fc5e9e223a6bd44f89f674ee3b2e29b99e.tar.bz2
gh-95191: IDLE: Include prompts when saving Shell #95554
Diffstat (limited to 'Lib/idlelib/idle_test')
-rw-r--r--Lib/idlelib/idle_test/test_iomenu.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/Lib/idlelib/idle_test/test_iomenu.py b/Lib/idlelib/idle_test/test_iomenu.py
index e338893..2fb836d 100644
--- a/Lib/idlelib/idle_test/test_iomenu.py
+++ b/Lib/idlelib/idle_test/test_iomenu.py
@@ -1,10 +1,12 @@
"Test , coverage 17%."
-from idlelib import iomenu, util
+from idlelib import iomenu
import unittest
from test.support import requires
from tkinter import Tk
from idlelib.editor import EditorWindow
+from idlelib import util
+from idlelib.idle_test.mock_idle import Func
class IOBindingTest(unittest.TestCase):
@@ -36,9 +38,14 @@ class IOBindingTest(unittest.TestCase):
io = self.io
fix = io.fixnewlines
text = io.editwin.text
+
+ # Make the editor temporarily look like Shell.
self.editwin.interp = None
- eq(fix(), '')
- del self.editwin.interp
+ shelltext = '>>> if 1'
+ self.editwin.get_prompt_text = Func(result=shelltext)
+ eq(fix(), shelltext) # Get... call and '\n' not added.
+ del self.editwin.interp, self.editwin.get_prompt_text
+
text.insert(1.0, 'a')
eq(fix(), 'a'+io.eol_convention)
eq(text.get('1.0', 'end-1c'), 'a\n')