bpo-33642: IDLE: Use variable number of lines in CodeContext. (GH-7106) · python/cpython@0800b6c (original) (raw)
`@@ -110,7 +110,7 @@ def test_del(self):
`
110
110
``
111
111
`def test_reload(self):
`
112
112
`codecontext.CodeContext.reload()
`
113
``
`-
self.assertEqual(self.cc.context_depth, 3)
`
``
113
`+
self.assertEqual(self.cc.context_depth, 15)
`
114
114
``
115
115
`def test_toggle_code_context_event(self):
`
116
116
`eq = self.assertEqual
`
`@@ -127,7 +127,7 @@ def test_toggle_code_context_event(self):
`
127
127
`eq(cc.label['font'], cc.textfont)
`
128
128
`eq(cc.label['fg'], cc.fgcolor)
`
129
129
`eq(cc.label['bg'], cc.bgcolor)
`
130
``
`-
eq(cc.label['text'], '\n' * 2)
`
``
130
`+
eq(cc.label['text'], '')
`
131
131
``
132
132
`# Toggle off.
`
133
133
`eq(toggle(), 'break')
`
`@@ -193,24 +193,26 @@ def test_update_code_context(self):
`
193
193
`eq(cc.info, [(0, -1, '', False)])
`
194
194
`eq(cc.topvisible, 1)
`
195
195
``
``
196
`+
Scroll down to line 1.
`
``
197
`+
cc.text.yview(1)
`
``
198
`+
cc.update_code_context()
`
``
199
`+
eq(cc.info, [(0, -1, '', False)])
`
``
200
`+
eq(cc.topvisible, 2)
`
``
201
`+
eq(cc.label['text'], '')
`
``
202
+
196
203
`# Scroll down to line 2.
`
197
204
`cc.text.yview(2)
`
198
205
`cc.update_code_context()
`
199
206
`eq(cc.info, [(0, -1, '', False), (2, 0, 'class C1():', 'class')])
`
200
207
`eq(cc.topvisible, 3)
`
201
``
`-
context_depth is 3 so it pads with blank lines.
`
202
``
`-
eq(cc.label['text'], '\n'
`
203
``
`-
'\n'
`
204
``
`-
'class C1():')
`
``
208
`+
eq(cc.label['text'], 'class C1():')
`
205
209
``
206
210
`# Scroll down to line 3. Since it's a comment, nothing changes.
`
207
211
`cc.text.yview(3)
`
208
212
`cc.update_code_context()
`
209
213
`eq(cc.info, [(0, -1, '', False), (2, 0, 'class C1():', 'class')])
`
210
214
`eq(cc.topvisible, 4)
`
211
``
`-
eq(cc.label['text'], '\n'
`
212
``
`-
'\n'
`
213
``
`-
'class C1():')
`
``
215
`+
eq(cc.label['text'], 'class C1():')
`
214
216
``
215
217
`# Scroll down to line 4.
`
216
218
`cc.text.yview(4)
`
`@@ -219,8 +221,7 @@ def test_update_code_context(self):
`
219
221
` (2, 0, 'class C1():', 'class'),
`
220
222
` (4, 4, ' def init(self, a, b):', 'def')])
`
221
223
`eq(cc.topvisible, 5)
`
222
``
`-
eq(cc.label['text'], '\n'
`
223
``
`-
'class C1():\n'
`
``
224
`+
eq(cc.label['text'], 'class C1():\n'
`
224
225
`' def init(self, a, b):')
`
225
226
``
226
227
`# Scroll down to line 11. Last 'def' is removed.
`
`@@ -232,7 +233,8 @@ def test_update_code_context(self):
`
232
233
` (8, 8, ' if a > b:', 'if'),
`
233
234
` (10, 8, ' elif a < b:', 'elif')])
`
234
235
`eq(cc.topvisible, 12)
`
235
``
`-
eq(cc.label['text'], ' def compare(self):\n'
`
``
236
`+
eq(cc.label['text'], 'class C1():\n'
`
``
237
`+
' def compare(self):\n'
`
236
238
`' if a > b:\n'
`
237
239
`' elif a < b:')
`
238
240
``
`@@ -245,7 +247,8 @@ def test_update_code_context(self):
`
245
247
` (8, 8, ' if a > b:', 'if'),
`
246
248
` (10, 8, ' elif a < b:', 'elif')])
`
247
249
`eq(cc.topvisible, 12)
`
248
``
`-
eq(cc.label['text'], ' def compare(self):\n'
`
``
250
`+
eq(cc.label['text'], 'class C1():\n'
`
``
251
`+
' def compare(self):\n'
`
249
252
`' if a > b:\n'
`
250
253
`' elif a < b:')
`
251
254
``