bpo-33907: Rename an IDLE module and class. (GH-7807) · python/cpython@b89a376

1-

"Test calltips, coverage 60%"

1+

"Test calltip, coverage 60%"

223-

from idlelib import calltips

3+

from idlelib import calltip

44

import unittest

55

import textwrap

66

import types

778-

default_tip = calltips._default_callable_argspec

8+

default_tip = calltip._default_callable_argspec

9910101111

# Test Class TC is used in multiple get_argspec test methods

@@ -36,7 +36,7 @@ def sm(b): 'doc'

363637373838

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

404041414242

class Get_signatureTest(unittest.TestCase):

@@ -59,17 +59,17 @@ def gtest(obj, out):

5959

self.assertEqual(signature(obj), out)

60606161

if List.__doc__ is not None:

62-

gtest(List, '(iterable=(), /)' + calltips._argument_positional

62+

gtest(List, '(iterable=(), /)' + calltip._argument_positional

6363

+ '\n' + List.__doc__)

6464

gtest(list.__new__,

6565

'(*args, **kwargs)\n'

6666

'Create and return a new object. '

6767

'See help(type) for accurate signature.')

6868

gtest(list.__init__,

6969

'(self, /, *args, **kwargs)'

70-

+ calltips._argument_positional + '\n' +

70+

+ calltip._argument_positional + '\n' +

7171

'Initialize self. See help(type(self)) for accurate signature.')

72-

append_doc = (calltips._argument_positional

72+

append_doc = (calltip._argument_positional

7373

+ "\nAppend object to the end of the list.")

7474

gtest(list.append, '(self, object, /)' + append_doc)

7575

gtest(List.append, '(self, object, /)' + append_doc)

@@ -102,7 +102,7 @@ def test_signature_wrap(self):

102102

def test_docline_truncation(self):

103103

def f(): pass

104104

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) + '...')

106106107107

def test_multiline_docstring(self):

108108

# Test fewer lines than max.

@@ -121,7 +121,7 @@ def test_multiline_docstring(self):

121121

# Test more than max lines

122122

def f(): pass

123123

f.__doc__ = 'a\n' * 15

124-

self.assertEqual(signature(f), '()' + '\na' * calltips._MAX_LINES)

124+

self.assertEqual(signature(f), '()' + '\na' * calltip._MAX_LINES)

125125126126

def test_functions(self):

127127

def t1(): 'doc'

@@ -168,15 +168,15 @@ def m2(**kwargs): pass

168168

class Test:

169169

def __call__(*, a): pass

170170171-

mtip = calltips._invalid_method

171+

mtip = calltip._invalid_method

172172

self.assertEqual(signature(C().m2), mtip)

173173

self.assertEqual(signature(Test()), mtip)

174174175175

def test_non_ascii_name(self):

176176

# test that re works to delete a first parameter name that

177177

# includes non-ascii chars, such as various forms of A.

178178

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)'

180180181181

def test_no_docstring(self):

182182

def nd(s):

@@ -209,9 +209,9 @@ def test_non_callables(self):

209209210210

class Get_entityTest(unittest.TestCase):

211211

def test_bad_entity(self):

212-

self.assertIsNone(calltips.get_entity('1/0'))

212+

self.assertIsNone(calltip.get_entity('1/0'))

213213

def test_good_entity(self):

214-

self.assertIs(calltips.get_entity('int'), int)

214+

self.assertIs(calltip.get_entity('int'), int)

215215216216217217

if __name__ == '__main__':