bpo-33907: Rename an IDLE module and class. (GH-7807) · python/cpython@06e2029 (original) (raw)
1
``
`-
"Test calltips, coverage 60%"
`
``
1
`+
"Test calltip, coverage 60%"
`
2
2
``
3
``
`-
from idlelib import calltips
`
``
3
`+
from idlelib import calltip
`
4
4
`import unittest
`
5
5
`import textwrap
`
6
6
`import types
`
7
7
``
8
``
`-
default_tip = calltips._default_callable_argspec
`
``
8
`+
default_tip = calltip._default_callable_argspec
`
9
9
``
10
10
``
11
11
`# Test Class TC is used in multiple get_argspec test methods
`
`@@ -36,7 +36,7 @@ def sm(b): 'doc'
`
36
36
``
37
37
``
38
38
`tc = TC()
`
39
``
`-
signature = calltips.get_argspec # 2.7 and 3.x use different functions
`
``
39
`+
signature = calltip.get_argspec # 2.7 and 3.x use different functions
`
40
40
``
41
41
``
42
42
`class Get_signatureTest(unittest.TestCase):
`
`@@ -59,17 +59,17 @@ def gtest(obj, out):
`
59
59
`self.assertEqual(signature(obj), out)
`
60
60
``
61
61
`if List.doc is not None:
`
62
``
`-
gtest(List, '(iterable=(), /)' + calltips._argument_positional
`
``
62
`+
gtest(List, '(iterable=(), /)' + calltip._argument_positional
`
63
63
`+ '\n' + List.doc)
`
64
64
`gtest(list.new,
`
65
65
`'(*args, **kwargs)\n'
`
66
66
`'Create and return a new object. '
`
67
67
`'See help(type) for accurate signature.')
`
68
68
`gtest(list.init,
`
69
69
`'(self, /, *args, **kwargs)'
`
70
``
`-
- calltips._argument_positional + '\n' +
`
``
70
`+
- calltip._argument_positional + '\n' +
`
71
71
`'Initialize self. See help(type(self)) for accurate signature.')
`
72
``
`-
append_doc = (calltips._argument_positional
`
``
72
`+
append_doc = (calltip._argument_positional
`
73
73
`+ "\nAppend object to the end of the list.")
`
74
74
`gtest(list.append, '(self, object, /)' + append_doc)
`
75
75
`gtest(List.append, '(self, object, /)' + append_doc)
`
`@@ -102,7 +102,7 @@ def test_signature_wrap(self):
`
102
102
`def test_docline_truncation(self):
`
103
103
`def f(): pass
`
104
104
`f.doc = 'a'*300
`
105
``
`-
self.assertEqual(signature(f), '()\n' + 'a' * (calltips._MAX_COLS-3) + '...')
`
``
105
`+
self.assertEqual(signature(f), '()\n' + 'a' * (calltip._MAX_COLS-3) + '...')
`
106
106
``
107
107
`def test_multiline_docstring(self):
`
108
108
`# Test fewer lines than max.
`
`@@ -121,7 +121,7 @@ def test_multiline_docstring(self):
`
121
121
`# Test more than max lines
`
122
122
`def f(): pass
`
123
123
`f.doc = 'a\n' * 15
`
124
``
`-
self.assertEqual(signature(f), '()' + '\na' * calltips._MAX_LINES)
`
``
124
`+
self.assertEqual(signature(f), '()' + '\na' * calltip._MAX_LINES)
`
125
125
``
126
126
`def test_functions(self):
`
127
127
`def t1(): 'doc'
`
`@@ -168,15 +168,15 @@ def m2(**kwargs): pass
`
168
168
`class Test:
`
169
169
`def call(*, a): pass
`
170
170
``
171
``
`-
mtip = calltips._invalid_method
`
``
171
`+
mtip = calltip._invalid_method
`
172
172
`self.assertEqual(signature(C().m2), mtip)
`
173
173
`self.assertEqual(signature(Test()), mtip)
`
174
174
``
175
175
`def test_non_ascii_name(self):
`
176
176
`# test that re works to delete a first parameter name that
`
177
177
`# includes non-ascii chars, such as various forms of A.
`
178
178
`uni = "(A\u0391\u0410\u05d0\u0627\u0905\u1e00\u3042, a)"
`
179
``
`-
assert calltips._first_param.sub('', uni) == '(a)'
`
``
179
`+
assert calltip._first_param.sub('', uni) == '(a)'
`
180
180
``
181
181
`def test_no_docstring(self):
`
182
182
`def nd(s):
`
`@@ -209,9 +209,9 @@ def test_non_callables(self):
`
209
209
``
210
210
`class Get_entityTest(unittest.TestCase):
`
211
211
`def test_bad_entity(self):
`
212
``
`-
self.assertIsNone(calltips.get_entity('1/0'))
`
``
212
`+
self.assertIsNone(calltip.get_entity('1/0'))
`
213
213
`def test_good_entity(self):
`
214
``
`-
self.assertIs(calltips.get_entity('int'), int)
`
``
214
`+
self.assertIs(calltip.get_entity('int'), int)
`
215
215
``
216
216
``
217
217
`if name == 'main':
`