summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/idle_test/test_codecontext.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/idlelib/idle_test/test_codecontext.py')
-rw-r--r--Lib/idlelib/idle_test/test_codecontext.py29
1 files changed, 16 insertions, 13 deletions
diff --git a/Lib/idlelib/idle_test/test_codecontext.py b/Lib/idlelib/idle_test/test_codecontext.py
index ed45828..4c775ee 100644
--- a/Lib/idlelib/idle_test/test_codecontext.py
+++ b/Lib/idlelib/idle_test/test_codecontext.py
@@ -110,7 +110,7 @@ class CodeContextTest(unittest.TestCase):
def test_reload(self):
codecontext.CodeContext.reload()
- self.assertEqual(self.cc.context_depth, 3)
+ self.assertEqual(self.cc.context_depth, 15)
def test_toggle_code_context_event(self):
eq = self.assertEqual
@@ -127,7 +127,7 @@ class CodeContextTest(unittest.TestCase):
eq(cc.label['font'], cc.textfont)
eq(cc.label['fg'], cc.fgcolor)
eq(cc.label['bg'], cc.bgcolor)
- eq(cc.label['text'], '\n' * 2)
+ eq(cc.label['text'], '')
# Toggle off.
eq(toggle(), 'break')
@@ -193,24 +193,26 @@ class CodeContextTest(unittest.TestCase):
eq(cc.info, [(0, -1, '', False)])
eq(cc.topvisible, 1)
+ # Scroll down to line 1.
+ cc.text.yview(1)
+ cc.update_code_context()
+ eq(cc.info, [(0, -1, '', False)])
+ eq(cc.topvisible, 2)
+ eq(cc.label['text'], '')
+
# Scroll down to line 2.
cc.text.yview(2)
cc.update_code_context()
eq(cc.info, [(0, -1, '', False), (2, 0, 'class C1():', 'class')])
eq(cc.topvisible, 3)
- # context_depth is 3 so it pads with blank lines.
- eq(cc.label['text'], '\n'
- '\n'
- 'class C1():')
+ eq(cc.label['text'], 'class C1():')
# Scroll down to line 3. Since it's a comment, nothing changes.
cc.text.yview(3)
cc.update_code_context()
eq(cc.info, [(0, -1, '', False), (2, 0, 'class C1():', 'class')])
eq(cc.topvisible, 4)
- eq(cc.label['text'], '\n'
- '\n'
- 'class C1():')
+ eq(cc.label['text'], 'class C1():')
# Scroll down to line 4.
cc.text.yview(4)
@@ -219,8 +221,7 @@ class CodeContextTest(unittest.TestCase):
(2, 0, 'class C1():', 'class'),
(4, 4, ' def __init__(self, a, b):', 'def')])
eq(cc.topvisible, 5)
- eq(cc.label['text'], '\n'
- 'class C1():\n'
+ eq(cc.label['text'], 'class C1():\n'
' def __init__(self, a, b):')
# Scroll down to line 11. Last 'def' is removed.
@@ -232,7 +233,8 @@ class CodeContextTest(unittest.TestCase):
(8, 8, ' if a > b:', 'if'),
(10, 8, ' elif a < b:', 'elif')])
eq(cc.topvisible, 12)
- eq(cc.label['text'], ' def compare(self):\n'
+ eq(cc.label['text'], 'class C1():\n'
+ ' def compare(self):\n'
' if a > b:\n'
' elif a < b:')
@@ -245,7 +247,8 @@ class CodeContextTest(unittest.TestCase):
(8, 8, ' if a > b:', 'if'),
(10, 8, ' elif a < b:', 'elif')])
eq(cc.topvisible, 12)
- eq(cc.label['text'], ' def compare(self):\n'
+ eq(cc.label['text'], 'class C1():\n'
+ ' def compare(self):\n'
' if a > b:\n'
' elif a < b:')