[Python-Dev] [Python-checkins] cpython: Issue #14769: test_capi now has SkipitemTest, which cleverly checks

MRAB python at mrabarnett.plus.com
Fri Jun 22 20:21:25 CEST 2012


On 22/06/2012 17:39, Terry Reedy wrote:
> On 6/22/2012 6:57 AM, larry.hastings wrote:
>> http://hg.python.org/cpython/rev/ace45d23628a
>> changeset:   77567:ace45d23628a
>> user:        Larry Hastings <larry at hastings.org>
>> date:        Fri Jun 22 03:56:29 2012 -0700
>> summary:
>>    Issue #14769: test_capi now has SkipitemTest, which cleverly checks
>> for "parity" between PyArg_ParseTuple() and the Python/getargs.c static
>> function skipitem() for all possible "format units".
>
> You sensibly only test printable ascii chars, which are in the
> contiguous range 32 to 127 inclusive. So it makes no sense to claim
> otherwise and then deny the wrong claim, or to enlarge the range and
> then shrink it again.
>
ASCII character 127 is a control character, not a printable character.

>> +        This function brute-force tests all** ASCII characters (1 to 127
>> +        inclusive) as format units, checking to see that
>
There are 128 ASCII characters (0 to 127 inclusive).

> With a few exceptions**, test all printable ASCII characters (32 to 127
> inclusive) as...
>
>> +
>> +          ** Okay, it actually skips some ASCII characters.  Some characters
>
> ** Some characters ...
>> +             have special funny semantics, and it would be difficult to
>> +             accomodate them here.
>
>> +        for i in range(1, 128):
>
> for i in range(32, 128):
>
>
>> +            if (not c.isprintable()) or (c in '()e|$'):
>
> if c in '()e|$':
>


More information about the Python-Dev mailing list