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.

Author larry
Recipients benjamin.peterson, larry
Date 2012-05-10.08:42:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1336639357.09.0.810627542534.issue14769@psf.upfronthosting.co.za>
In-reply-to
Content
I recently fixed an old bug: some time ago someone added support for a new "format unit", 'Z', to PyArg_Parse(), but neglected to add matching support for it to skipitem().  Benjamin asked for a regression test.  Initially I said, okay, how the hell do I test that?  A quick grep showed that there was already a test like that, for the format unit 'C'.  I figured adding another one-off test was dumb, and there had to be a better way.

Attached is a patch against trunk that adds a new function to _testcapimodule.c: test_skipitem_parity().  The comment at the top describes says it best:

 * This function brute-force tests all** ASCII characters (1 to 127
 * inclusive) as format units, checking to see that
 * PyArg_ParseTupleAndKeywords() return consistent errors both when
 * the unit is attempted to be used and when it is skipped.  If the
 * format unit doesn't exist, we'll get one of two specific error
 * messages (one for used, one for skipped); if it does exist we
 * *won't* get that error--we'll get either no error or some other
 * error.  If we get the "does not exist" error for one test and
 * not for the other, there's a mismatch, and the test fails.
 *
 *   ** Okay, it actually skips some ASCII characters.  Some characters
 *      have special funny semantics, and it would be difficult to
 *      accomodate them here.

I also removed the old test just for 'C', as this test subsumes that one.

Right now, the test runs to completion without complaint.  To test that it's really working, comment out an existing case statement in skipitem().  Or, add a new case statement, for a character that isn't otherwise supported (yet), to the top paragraph of case statements.  Doing either of these will cause a failure.

... you happy now, Benjamin?
History
Date User Action Args
2012-05-10 08:42:37larrysetrecipients: + larry, benjamin.peterson
2012-05-10 08:42:37larrysetmessageid: <1336639357.09.0.810627542534.issue14769@psf.upfronthosting.co.za>
2012-05-10 08:42:36larrylinkissue14769 messages
2012-05-10 08:42:36larrycreate