[3.6] bpo-33907: Rename an IDLE module and class. (GH-7807) (GH-7809) · python/cpython@e97a685 (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):
`
`@@ -66,7 +66,7 @@ def gtest(obj, out):
`
66
66
`' See help(type) for accurate signature.')
`
67
67
`gtest(list.init,
`
68
68
`'(self, /, *args, **kwargs)'
`
69
``
`-
- calltips._argument_positional + '\n' +
`
``
69
`+
- calltip._argument_positional + '\n' +
`
70
70
`'Initialize self. See help(type(self)) for accurate signature.')
`
71
71
`append_doc = "L.append(object) -> None -- append object to end"
`
72
72
`gtest(list.append, append_doc)
`
`@@ -100,7 +100,7 @@ def test_signature_wrap(self):
`
100
100
`def test_docline_truncation(self):
`
101
101
`def f(): pass
`
102
102
`f.doc = 'a'*300
`
103
``
`-
self.assertEqual(signature(f), '()\n' + 'a' * (calltips._MAX_COLS-3) + '...')
`
``
103
`+
self.assertEqual(signature(f), '()\n' + 'a' * (calltip._MAX_COLS-3) + '...')
`
104
104
``
105
105
`def test_multiline_docstring(self):
`
106
106
`# Test fewer lines than max.
`
`@@ -119,7 +119,7 @@ def test_multiline_docstring(self):
`
119
119
`# Test more than max lines
`
120
120
`def f(): pass
`
121
121
`f.doc = 'a\n' * 15
`
122
``
`-
self.assertEqual(signature(f), '()' + '\na' * calltips._MAX_LINES)
`
``
122
`+
self.assertEqual(signature(f), '()' + '\na' * calltip._MAX_LINES)
`
123
123
``
124
124
`def test_functions(self):
`
125
125
`def t1(): 'doc'
`
`@@ -166,15 +166,15 @@ def m2(**kwargs): pass
`
166
166
`class Test:
`
167
167
`def call(*, a): pass
`
168
168
``
169
``
`-
mtip = calltips._invalid_method
`
``
169
`+
mtip = calltip._invalid_method
`
170
170
`self.assertEqual(signature(C().m2), mtip)
`
171
171
`self.assertEqual(signature(Test()), mtip)
`
172
172
``
173
173
`def test_non_ascii_name(self):
`
174
174
`# test that re works to delete a first parameter name that
`
175
175
`# includes non-ascii chars, such as various forms of A.
`
176
176
`uni = "(A\u0391\u0410\u05d0\u0627\u0905\u1e00\u3042, a)"
`
177
``
`-
assert calltips._first_param.sub('', uni) == '(a)'
`
``
177
`+
assert calltip._first_param.sub('', uni) == '(a)'
`
178
178
``
179
179
`def test_no_docstring(self):
`
180
180
`def nd(s):
`
`@@ -207,9 +207,9 @@ def test_non_callables(self):
`
207
207
``
208
208
`class Get_entityTest(unittest.TestCase):
`
209
209
`def test_bad_entity(self):
`
210
``
`-
self.assertIsNone(calltips.get_entity('1/0'))
`
``
210
`+
self.assertIsNone(calltip.get_entity('1/0'))
`
211
211
`def test_good_entity(self):
`
212
``
`-
self.assertIs(calltips.get_entity('int'), int)
`
``
212
`+
self.assertIs(calltip.get_entity('int'), int)
`
213
213
``
214
214
``
215
215
`if name == 'main':
`