Lines Matching refs:self

16     def __init__(self, ai=None, *b): 'doc'
17 __init__.tip = "(self, ai=None, *b)"
18 def t1(self): 'doc'
19 t1.tip = "(self)"
20 def t2(self, ai, b=None): 'doc'
21 t2.tip = "(self, ai, b=None)"
22 def t3(self, ai, *args): 'doc'
23 t3.tip = "(self, ai, *args)"
24 def t4(self, *args): 'doc'
25 t4.tip = "(self, *args)"
26 def t5(self, ai, b=None, *args, **kw): 'doc'
27 t5.tip = "(self, ai, b=None, *args, **kw)"
28 def t6(no, self): 'doc'
29 t6.tip = "(no, self)"
30 def __call__(self, ci): 'doc'
31 __call__.tip = "(self, ci)"
32 def nd(self): pass # No doc.
53 def test_builtins(self):
56 self.assertEqual(get_spec(obj), out)
73 '(self, /, *args, **kwargs)\n'
74 'Initialize self. See help(type(self)) for accurate signature.')
76 tiptest(list.append, '(self, object, /)' + append_doc)
77 tiptest(List.append, '(self, object, /)' + append_doc)
98 def test_signature_wrap(self):
100 self.assertEqual(get_spec(textwrap.TextWrapper), '''\
111 def test_properly_formatted(self):
138 with self.subTest(func=func, doc=doc):
139 self.assertEqual(get_spec(func), doc)
141 def test_docline_truncation(self):
144 self.assertEqual(get_spec(f), f"()\n{'a'*(calltip._MAX_COLS-3) + '...'}")
146 def test_multiline_docstring(self):
148 self.assertEqual(get_spec(range),
153 self.assertEqual(get_spec(bytes), '''\
163 self.assertEqual(get_spec(f), '()' + '\na' * calltip._MAX_LINES)
165 def test_functions(self):
179 with self.subTest(func=func):
180 self.assertEqual(get_spec(func), func.tip + doc)
182 def test_methods(self):
185 with self.subTest(meth=meth):
186 self.assertEqual(get_spec(meth), meth.tip + doc)
187 self.assertEqual(get_spec(TC.cm), "(a)" + doc)
188 self.assertEqual(get_spec(TC.sm), "(b)" + doc)
190 def test_bound_methods(self):
194 (tc.t6, "(self)"), (tc.__call__, '(ci)'),
196 with self.subTest(meth=meth, mtip=mtip):
197 self.assertEqual(get_spec(meth), mtip + doc)
199 def test_starred_parameter(self):
205 with self.subTest(meth=meth, mtip=mtip):
206 self.assertEqual(get_spec(meth), mtip)
208 def test_invalid_method_get_spec(self):
215 self.assertEqual(get_spec(C().m2), mtip)
216 self.assertEqual(get_spec(Test()), mtip)
218 def test_non_ascii_name(self):
224 def test_no_docstring(self):
225 for meth, mtip in ((TC.nd, "(self)"), (tc.nd, "()")):
226 with self.subTest(meth=meth, mtip=mtip):
227 self.assertEqual(get_spec(meth), mtip)
229 def test_buggy_getattr_class(self):
231 def __getattr__(self, name): # Not invoked for class attribute.
234 def __call__(self, ci): # Bug does not matter.
237 def __call__(oui, a, b, c): # Non-standard 'self'.
243 with self.subTest(meth=meth, mtip=mtip):
244 self.assertEqual(get_spec(meth), mtip)
246 def test_metaclass_class(self): # Failure case for issue 38689.
253 with self.subTest(meth=meth, mtip=mtip):
254 self.assertEqual(get_spec(meth), mtip)
256 def test_non_callables(self):
258 with self.subTest(obj=obj):
259 self.assertEqual(get_spec(obj), '')
263 def test_bad_entity(self):
264 self.assertIsNone(calltip.get_entity('1/0'))
265 def test_good_entity(self):
266 self.assertIs(calltip.get_entity('int'), int)
275 def __init__(self, text):
277 self.text = text
278 self.prompt_last_line = ">>> "
279 self.indentwidth = 4
280 self.tabwidth = 8
284 def __init__(self):
287 def showtip(self, text, parenleft, parenright):
288 self.args = parenleft, parenright
289 self.parenline, self.parencol = map(int, parenleft.split('.'))
293 def _make_tk_calltip_window(self):
296 def remove_calltip_window(self, event=None):
297 if self.active_calltip: # Setup to None.
298 self.active_calltip = None
299 self.tips_removed += 1 # Setup to 0.
301 def fetch_tip(self, expression):
312 def setUp(self):
313 self.text.delete('1.0', 'end') # Insert and call
314 self.ct.active_calltip = None
316 self.ct.tips_removed = 0
318 def open_close(self, testfunc):
320 opentip = self.ct.open_calltip
321 self.text.insert(1.0, 'f(')
323 self.tip = self.ct.active_calltip
324 testfunc(self) ###
325 self.text.insert('insert', ')')
327 self.assertIsNone(self.ct.active_calltip, None)
329 def test_open_close(self):
330 def args(self):
331 self.assertEqual(self.tip.args, ('1.1', '1.end'))
332 self.open_close(args)
334 def test_repeated_force(self):
335 def force(self):
337 self.text.insert('insert', 'a')
338 self.ct.open_calltip(True)
339 self.ct.open_calltip(True)
340 self.assertIs(self.ct.active_calltip, self.tip)
341 self.open_close(force)
343 def test_repeated_parens(self):
344 def parens(self):
346 with self.subTest(context=context):
347 self.text.insert('insert', context)
349 self.text.insert('insert', char)
350 self.assertIs(self.ct.active_calltip, self.tip)
351 self.text.insert('insert', "'")
352 self.open_close(parens)
354 def test_comment_parens(self):
355 def comment(self):
356 self.text.insert('insert', "# ")
358 self.text.insert('insert', char)
359 self.assertIs(self.ct.active_calltip, self.tip)
360 self.text.insert('insert', "\n")
361 self.open_close(comment)