Lines Matching refs:self
25 def __init__(self, a, b):
26 self.a = a
27 self.b = b
28 def compare(self):
39 def __init__(self, root, frame, text):
40 self.root = root
41 self.top = root
42 self.text_frame = frame
43 self.text = text
44 self.label = ''
46 def getlineno(self, index):
47 return int(float(self.text.index(index)))
49 def update_menu_label(self, **kwargs):
50 self.label = kwargs['label']
78 def setUp(self):
79 self.text.yview(0)
80 self.text['font'] = 'TkFixedFont'
81 self.cc = codecontext.CodeContext(self.editor)
83 self.highlight_cfg = {"background": '#abcdef',
88 return self.highlight_cfg
93 self.addCleanup(GetHighlight_patcher.stop)
95 self.font_override = 'TkFixedFont'
97 return self.font_override
101 self.addCleanup(GetFont_patcher.stop)
103 def tearDown(self):
104 if self.cc.context:
105 self.cc.context.destroy()
107 self.cc.__del__()
108 del self.cc.context, self.cc
110 def test_init(self):
111 eq = self.assertEqual
112 ed = self.editor
113 cc = self.cc
118 self.assertIsNone(cc.context)
121 self.assertIsNone(self.cc.t1)
123 def test_del(self):
124 self.cc.__del__()
126 def test_del_with_timer(self):
127 timer = self.cc.t1 = self.text.after(10000, lambda: None)
128 self.cc.__del__()
129 with self.assertRaises(TclError) as cm:
130 self.root.tk.call('after', 'info', timer)
131 self.assertIn("doesn't exist", str(cm.exception))
133 def test_reload(self):
135 self.assertEqual(self.cc.context_depth, 15)
137 def test_toggle_code_context_event(self):
138 eq = self.assertEqual
139 cc = self.cc
148 self.assertIsNotNone(cc.context)
149 eq(cc.context['font'], self.text['font'])
150 eq(cc.context['fg'], self.highlight_cfg['foreground'])
151 eq(cc.context['bg'], self.highlight_cfg['background'])
154 eq(self.root.tk.call('after', 'info', self.cc.t1)[1], 'timer')
158 self.assertIsNone(cc.context)
160 self.assertIsNone(self.cc.t1)
173 def test_get_context(self):
174 eq = self.assertEqual
175 gc = self.cc.get_context
178 with self.assertRaises(AssertionError):
188 (4, 4, ' def __init__(self, a, b):', 'def')], 0))
192 (7, 4, ' def compare(self):', 'def'),
197 (7, 4, ' def compare(self):', 'def'),
204 (7, 4, ' def compare(self):', 'def'),
207 eq(gc(11, stopline=3), ([(7, 4, ' def compare(self):', 'def'),
214 eq(gc(11, stopindent=4), ([(7, 4, ' def compare(self):', 'def'),
221 def test_update_code_context(self):
222 eq = self.assertEqual
223 cc = self.cc
229 self.assertIsNone(cc.update_code_context())
259 (4, 4, ' def __init__(self, a, b):', 'def')])
262 ' def __init__(self, a, b):')
269 (7, 4, ' def compare(self):', 'def'),
274 ' def compare(self):\n'
283 (7, 4, ' def compare(self):', 'def'),
288 ' def compare(self):\n'
297 (4, 4, ' def __init__(self, a, b):', 'def')])
300 eq(cc.context.get('1.0', 'end-1c'), ' def __init__(self, a, b):')
302 def test_jumptoline(self):
303 eq = self.assertEqual
304 cc = self.cc
344 def test_timer_event(self, mock_update):
346 if self.cc.context:
347 self.cc.toggle_code_context_event()
348 self.cc.timer_event()
352 self.cc.toggle_code_context_event()
353 self.cc.timer_event()
356 def test_font(self):
357 eq = self.assertEqual
358 cc = self.cc
362 self.assertNotEqual(orig_font, test_font)
368 self.font_override = test_font
377 self.font_override = orig_font
381 def test_highlight_colors(self):
382 eq = self.assertEqual
383 cc = self.cc
385 orig_colors = dict(self.highlight_cfg)
396 self.highlight_cfg = test_colors
409 self.highlight_cfg = orig_colors
416 def test_get_spaces_firstword(self):
428 self.assertEqual(get(line), expected_output)
431 self.assertEqual(get(' (continuation)',
435 def test_get_line_info(self):
436 eq = self.assertEqual
447 eq(gli(lines[3]), (4, ' def __init__(self, a, b):', 'def'))