This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: IDLE list.append calltips test failures
Type: behavior Stage: resolved
Components: IDLE Versions: Python 3.3, Python 3.4
process
Status: closed Resolution: fixed
Dependencies: 20122 Superseder:
Assigned To: Nosy List: chris.jerdonek, kbk, python-dev, terry.reedy
Priority: normal Keywords:

Created on 2012-12-10 02:31 by chris.jerdonek, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (5)
msg177253 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012-12-10 02:31
There are three IDLE test failures in the 3.2 branch:

$ ./python.exe Lib/idlelib/CallTips.py
list.append - expected
'L.append(object) -> None -- append object to end'
 - but got
'L.append(object) -- append object to end'
[].append - expected
'L.append(object) -> None -- append object to end'
 - but got
'L.append(object) -- append object to end'
List.append - expected
'L.append(object) -> None -- append object to end'
 - but got
'L.append(object) -- append object to end'
3 of 41 tests failed
msg177524 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2012-12-15 00:41
In 3.2.3
>>> list.append.__doc__
'L.append(object) -- append object to end'

In 3.3.0
>>> list.append.__doc__
'L.append(object) -> None -- append object to end'

I checked the other 6 pure mutation methods.
.sort, .extend, .remove, and the new .clear have the same new addition of ' -> None'.
.insert and .reverse do not (but it seems they should).

It seems I pushed the June 7 #12510 patch -- msg162510 -- which added the .append tests, without properly testing in 3.2. A fix for 3.2 is easy, but the deeper issue is the fragility of comparing external text to hard-coded expected text. I knew when I wrote the tests that that could and would be a problem in the future, but did not notice that it already was.

One solution is not to compare again external strings; but then how do we know that the tooltips work with such? Another is to fetch the external string in the test code, but that amounts to duplicating the code in the tooltip function and testing it against itself; so is it really a test? The third option is to leave the tests vulnerable and patch them in a version specific manner when they break.
msg177633 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012-12-16 22:13
Could you mock or monkey-patch what you are getting a tool tip for (i.e. set the "external" string you are checking for)?
msg208627 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-01-21 08:10
New changeset 779e5511d803 by Terry Jan Reedy in branch '2.7':
Issue #16655: Explain why Idle's test_calltips has 'fragile' tests of builtins.
http://hg.python.org/cpython/rev/779e5511d803

New changeset 4a505a901b2e by Terry Jan Reedy in branch '3.3':
Issue #16655: Explain why Idle's test_calltips has 'fragile' tests of builtins.
http://hg.python.org/cpython/rev/4a505a901b2e

New changeset c4a2d0538441 by Terry Jan Reedy in branch 'default':
Issue #16655: Explain why Idle's test_calltips has 'fragile' tests of builtins.
http://hg.python.org/cpython/rev/c4a2d0538441
msg208629 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-01-21 08:17
When I moved tests from CallTips.py to test_calltips.py, I reduced but did not eliminate the use of builtins. I decided instead to explain in the file why there is no substitute for the real thing, and how to fix a simple mismatch like that reported here.
History
Date User Action Args
2022-04-11 14:57:39adminsetgithub: 60859
2014-01-21 08:17:52terry.reedysetstatus: open -> closed
resolution: fixed
messages: + msg208629

stage: resolved
2014-01-21 08:10:24python-devsetnosy: + python-dev
messages: + msg208627
2014-01-04 16:28:54serhiy.storchakasetdependencies: + Move CallTips tests to idle_tests
2013-06-15 19:11:52terry.reedysetversions: + Python 3.3, Python 3.4, - Python 3.2
2012-12-16 22:13:57chris.jerdoneksetmessages: + msg177633
2012-12-15 00:41:36terry.reedysetnosy: + terry.reedy
messages: + msg177524
2012-12-10 02:31:20chris.jerdonekcreate