msg169725 - (view) |
Author: Chris Jerdonek (chris.jerdonek) *  |
Date: 2012-09-02 21:41 |
It seems like a couple error messages in the curses module need correcting: PyErr_SetString(PyExc_TypeError, "insch requires 1 or 4 arguments"); http://hg.python.org/cpython/file/8ff2f4634ed8/Modules/_cursesmodule.c#l1322 PyErr_SetString(PyExc_TypeError, "instr requires 0 or 3 arguments"); http://hg.python.org/cpython/file/8ff2f4634ed8/Modules/_cursesmodule.c#l1385 In both cases, "or" should be "to". |
|
|
msg169727 - (view) |
Author: R. David Murray (r.david.murray) *  |
Date: 2012-09-02 23:12 |
Given their signatures in the docs, I suspect it is more complicated than that. Perhaps the error messages are even correct. What does the code implement? |
|
|
msg169729 - (view) |
Author: Chris Jerdonek (chris.jerdonek) *  |
Date: 2012-09-02 23:24 |
I just completed a patch to improve the documentation of these signatures (along with many others) in issue 15831. The correction here is consistent with my findings and revised documentation there. As for the code, they are straightforward switch statements similar to many of the other methods in that module. I also did a manual test on one of the methods as a sanity check. I am preparing unit tests. |
|
|
msg169730 - (view) |
Author: Chris Jerdonek (chris.jerdonek) *  |
Date: 2012-09-02 23:28 |
The situation is the same in 2.7 (and probably 3.2). |
|
|
msg169736 - (view) |
Author: Chris Jerdonek (chris.jerdonek) *  |
Date: 2012-09-03 02:06 |
Attaching a patch with tests and fix for the default branch. |
|
|
msg169737 - (view) |
Author: Chris Jerdonek (chris.jerdonek) *  |
Date: 2012-09-03 02:08 |
Uploading correct file. |
|
|
msg170871 - (view) |
Author: Ezio Melotti (ezio.melotti) *  |
Date: 2012-09-21 09:10 |
Can't you use assertRaisesRegex? |
|
|
msg170900 - (view) |
Author: Chris Jerdonek (chris.jerdonek) *  |
Date: 2012-09-21 16:32 |
Thanks for taking a look at this, and good question. Without restructuring how the tests are done, I believe the short answer is no. The funny thing about this test module is that it does not actually have any unittest test cases. It just calls some functions. Failure happens if an exception is raised in any one of those functions. See here, for example: http://hg.python.org/cpython/file/59a2807872d5/Lib/test/test_curses.py#l35 |
|
|
msg170927 - (view) |
Author: Chris Jerdonek (chris.jerdonek) *  |
Date: 2012-09-21 21:33 |
FYI, I created issue 16000 :) to switch test_curses to using unittest.TestCase. |
|
|
msg187287 - (view) |
Author: Phil Connell (pconnell) * |
Date: 2013-04-18 20:14 |
The patch looks correct and complete, and still patches and passes the tests. So, as far as I can see, this can be committed. |
|
|
msg305388 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2017-11-01 18:03 |
Do you mind to create a pull request on GitHub Chris? In general the patch LGTM, but I don't think this minor typo fix needs tests for exact error messages. Adding new tests is good, but I think it is enough to test that corresponding functions accept the correct number of arguments and raise TypeError on incorrect number of arguments. |
|
|
msg308857 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2017-12-21 07:29 |
It was worth to honor Chris as the author of the patch in the commit message. |
|
|