homepage

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: Calltips test fails due to int docstring change
Type: behavior Stage: resolved
Components: IDLE Versions: Python 3.2, Python 3.3, Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: chris.jerdonek, python-dev, roger.serwy, serhiy.storchaka, terry.reedy
Priority: normal Keywords: easy, patch

Created on 2012年12月07日 01:29 by roger.serwy, last changed 2022年04月11日 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
calltips_test_update.patch roger.serwy, 2012年12月07日 01:29 review
idle_calltips_multiline_3.patch serhiy.storchaka, 2012年12月07日 18:25 review
Messages (20)
msg177063 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2012年12月07日 01:29
Revision e4598364ea29 changed the docstring for "int", causing the CallTips test to fail in IDLE.
The attached patch fixes the problem.
msg177070 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012年12月07日 07:21
Yes, I also noticed this. However, "int(x=0) -> integer" is not enough. The right calltip should be "int(x=0) -> integer\nint(x, base=10) -> integer".
msg177075 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012年12月07日 09:34
Here is a patch, which adds multiline calltips support.
msg177078 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012年12月07日 10:23
> Here is a patch, which adds multiline calltips support.
Serhiy, it looks like this issue/patch is just to fix the test and not to add "support." Also, it looks like the test only checks the first line, so that the second line shouldn't be added to the expected value. For example, the code comment for test_builtins() says:
 # if first line of a possibly multiline compiled docstring changes,
 # must change corresponding test string
msg177079 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012年12月07日 10:27
Sorry, I see that you changed the logic of get_argspec(). In that case, you should probably update the docstring of get_argspec() as well as the code comment I referenced (so that both say which lines are checked rather than the first line).
msg177080 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012年12月07日 10:53
Done. Here is an updated patch.
msg177101 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2012年12月07日 17:32
The number of lines in the return value of get_argspec should be limited, otherwise the calltip window can become too large. For example, many functions in the numpy project have very long doc strings.
msg177103 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012年12月07日 17:48
I would separate the issue of fixing the test (behavior) from adding support for multi-line tool tips (enhancement). Unless the policy for IDLE is different, it seems the latter should be limited to 3.4.
msg177104 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012年12月07日 18:00
> The number of lines in the return value of get_argspec should be limited, otherwise the calltip window can become too large.
Calltip limited by first empty line. But I agree, some reasonable hard limit (say 10 lines) should be.
> I would separate the issue of fixing the test (behavior) from adding support for multi-line tool tips (enhancement).
Then calltip will be wrong. `int` can accept two arguments, not only one. Alternative consistent solution is to revert all changes which were convert oneline signatures to multiline (I think you won't like this ;) ).
> Unless the policy for IDLE is different, it seems the latter should be limited to 3.4.
The policy for IDLE is different.
msg177108 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012年12月07日 18:25
Patch updated. Added hard limit (10) for number of calltip lines.
msg177110 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012年12月07日 18:52
I don't think it was ever a requirement of docstrings that their signature fit on one line or that they render fully in IDLE. Other built-in functions have multi-line signatures going back 10+ years (e.g. 32e7d0898eab).
I still think that the rendering of multi-line signatures should be considered separately. The discussion and issues are different, and people may have different opinions. For example, why not be smarter about detecting the end of the signature (e.g. first line not having "->")? Would you object to creating a new issue?
msg177116 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012年12月07日 19:26
> I don't think it was ever a requirement of docstrings that their signature fit on one line or that they render fully in IDLE.
I think this is a requirement of IDLE.
> I still think that the rendering of multi-line signatures should be considered separately. The discussion and issues are different, and people may have different opinions.
Then what about this issue? Legalize the current invalid behavior in the tests? I think that the tests should check the valid behavior and if tests failed then the behavior should be corrected, not tests should be faked.
> For example, why not be smarter about detecting the end of the signature (e.g. first line not having "->")?
This is a reasonable proposal. Let's discuss it.
The objection is that there are such signatures:
 foo(a, b, c,
 e, f, g) -> some result
> Would you object to creating a new issue?
There is no difference for me what issue it will be, but if it will be a different issue, then I do not see any sense in this issue.
msg177124 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012年12月07日 20:09
I created issue 16638 to add support for multi-line signatures.
> Then what about this issue?
This issue is to fix the failing test. The test that is failing is to check that fetch_tip correctly returns the first line of a built-in's docstring and that it handles inheritance correctly, etc. Its purpose is not to check that the docstrings are written a certain way. Otherwise, for example, it would be checking all built-ins rather than just choosing one example.
msg177132 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2012年12月07日 21:01
So, is the original patch which fixes the original issue OK to apply?
msg177133 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012年12月07日 21:05
Yes, I think so. I should be able to get to it in the next few days unless someone else beats me to it.
msg177249 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012年12月10日 02:01
FYI, in the 3.2 branch I get 4 failures rather than just the one due to int:
$ ./python.exe Lib/idlelib/CallTips.py
int - expected
'int(x[, base]) -> integer'
 - but got
'int(x=0) -> integer'
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'
4 of 41 tests failed
Also, what is the recommended way to run IDLE tests? It doesn't seem to be a part of regrtest, and I didn't see this information in the devguide.
msg177251 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012年12月10日 02:25
New changeset 181c170c6270 by Chris Jerdonek in branch '3.2':
Issue #16629: Fix IDLE idlelib.CallTips test. Patch by Roger Serwy.
http://hg.python.org/cpython/rev/181c170c6270
New changeset 5182cc18b7b4 by Chris Jerdonek in branch '3.3':
Issue #16629: Merge IDLE test fix from 3.2.
http://hg.python.org/cpython/rev/5182cc18b7b4
New changeset db17a49395c2 by Chris Jerdonek in branch 'default':
Issue #16629: Merge IDLE test fix from 3.3.
http://hg.python.org/cpython/rev/db17a49395c2 
msg177252 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012年12月10日 02:27
Thanks a lot, Roger!
msg177254 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012年12月10日 02:32
I created issue 16655 for the three test failures I observed above.
msg177360 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2012年12月12日 01:22
@Chris: Thanks for applying the patch. As for IDLE tests, there are no official tests. Issue15392 calls for the creation of a unit test framework. There are a few "tests" in some of IDLE, such as the ones in CallTips. Terry added much needed improvement for those tests in issue12510.
I will look at these issues with 3.2 as soon as I get a chance.
History
Date User Action Args
2022年04月11日 14:57:39adminsetgithub: 60833
2012年12月12日 01:22:22roger.serwysetmessages: + msg177360
2012年12月10日 02:32:18chris.jerdoneksetmessages: + msg177254
2012年12月10日 02:27:39chris.jerdoneksetstatus: open -> closed
resolution: fixed
messages: + msg177252

stage: patch review -> resolved
2012年12月10日 02:25:06python-devsetnosy: + python-dev
messages: + msg177251
2012年12月10日 02:01:39chris.jerdoneksetmessages: + msg177249
2012年12月07日 21:05:58chris.jerdoneksetmessages: + msg177133
2012年12月07日 21:01:46roger.serwysetmessages: + msg177132
2012年12月07日 20:09:55chris.jerdoneksetmessages: + msg177124
2012年12月07日 19:26:27serhiy.storchakasetmessages: + msg177116
2012年12月07日 18:52:06chris.jerdoneksetmessages: + msg177110
2012年12月07日 18:26:40serhiy.storchakasetfiles: - idle_calltips_multiline_2.patch
2012年12月07日 18:25:09serhiy.storchakasetfiles: + idle_calltips_multiline_3.patch

messages: + msg177108
2012年12月07日 18:00:09serhiy.storchakasetmessages: + msg177104
2012年12月07日 17:48:50chris.jerdoneksetmessages: + msg177103
2012年12月07日 17:32:20roger.serwysetmessages: + msg177101
2012年12月07日 10:54:09serhiy.storchakasetfiles: - idle_calltips_multiline.patch
2012年12月07日 10:53:34serhiy.storchakasetfiles: + idle_calltips_multiline_2.patch

messages: + msg177080
2012年12月07日 10:27:24chris.jerdoneksetmessages: + msg177079
2012年12月07日 10:23:18chris.jerdoneksetmessages: + msg177078
2012年12月07日 10:08:29serhiy.storchakasetnosy: + chris.jerdonek
2012年12月07日 09:34:37serhiy.storchakasetfiles: + idle_calltips_multiline.patch

messages: + msg177075
2012年12月07日 07:21:11serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg177070
2012年12月07日 01:29:30roger.serwycreate

AltStyle によって変換されたページ (->オリジナル) /