[Python-checkins] cpython (2.7): Issue #23825: Fixed test_idle under -OO.
serhiy.storchaka
python-checkins at python.org
Sat Apr 4 08:50:38 CEST 2015
https://hg.python.org/cpython/rev/912719dd684f
changeset: 95426:912719dd684f
branch: 2.7
parent: 95416:fe34dfea16b0
user: Serhiy Storchaka <storchaka at gmail.com>
date: Sat Apr 04 09:47:18 2015 +0300
summary:
Issue #23825: Fixed test_idle under -OO.
files:
Lib/idlelib/idle_test/test_calltips.py | 19 ++++++++-----
1 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/Lib/idlelib/idle_test/test_calltips.py b/Lib/idlelib/idle_test/test_calltips.py
--- a/Lib/idlelib/idle_test/test_calltips.py
+++ b/Lib/idlelib/idle_test/test_calltips.py
@@ -55,7 +55,8 @@
def gtest(obj, out):
self.assertEqual(signature(obj), out)
- gtest(List, '()\n' + List.__doc__)
+ if List.__doc__ is not None:
+ gtest(List, '()\n' + List.__doc__)
gtest(list.__new__,
'T.__new__(S, ...) -> a new object with type S, a subtype of T')
gtest(list.__init__,
@@ -70,7 +71,8 @@
def test_signature_wrap(self):
# This is also a test of an old-style class
- self.assertEqual(signature(textwrap.TextWrapper), '''\
+ if textwrap.TextWrapper.__doc__ is not None:
+ self.assertEqual(signature(textwrap.TextWrapper), '''\
(width=70, initial_indent='', subsequent_indent='', expand_tabs=True,
replace_whitespace=True, fix_sentence_endings=False, break_long_words=True,
drop_whitespace=True, break_on_hyphens=True)''')
@@ -106,20 +108,23 @@
def t5(a, b=None, *args, **kwds): 'doc'
t5.tip = "(a, b=None, *args, **kwargs)"
+ doc = '\ndoc' if t1.__doc__ is not None else ''
for func in (t1, t2, t3, t4, t5, TC):
- self.assertEqual(signature(func), func.tip + '\ndoc')
+ self.assertEqual(signature(func), func.tip + doc)
def test_methods(self):
+ doc = '\ndoc' if TC.__doc__ is not None else ''
for meth in (TC.t1, TC.t2, TC.t3, TC.t4, TC.t5, TC.t6, TC.__call__):
- self.assertEqual(signature(meth), meth.tip + "\ndoc")
- self.assertEqual(signature(TC.cm), "(a)\ndoc")
- self.assertEqual(signature(TC.sm), "(b)\ndoc")
+ self.assertEqual(signature(meth), meth.tip + doc)
+ self.assertEqual(signature(TC.cm), "(a)" + doc)
+ self.assertEqual(signature(TC.sm), "(b)" + doc)
def test_bound_methods(self):
# test that first parameter is correctly removed from argspec
+ doc = '\ndoc' if TC.__doc__ is not None else ''
for meth, mtip in ((tc.t1, "()"), (tc.t4, "(*args)"), (tc.t6, "(self)"),
(tc.__call__, '(ci)'), (tc, '(ci)'), (TC.cm, "(a)"),):
- self.assertEqual(signature(meth), mtip + "\ndoc")
+ self.assertEqual(signature(meth), mtip + doc)
def test_starred_parameter(self):
# test that starred first parameter is *not* removed from argspec
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list