Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
7e3e496a
Commit
7e3e496a
authored
Jun 22, 2012
by
Alexander Belopolsky
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
93c9cd07
48ed3602
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
19 deletions
+21
-19
Lib/test/test_capi.py
Lib/test/test_capi.py
+21
-19
No files found.
Lib/test/test_capi.py
View file @
7e3e496a
...
@@ -222,36 +222,38 @@ class SkipitemTest(unittest.TestCase):
...
@@ -222,36 +222,38 @@ class SkipitemTest(unittest.TestCase):
in Python/getargs.c, but neglected to update our poor friend
in Python/getargs.c, but neglected to update our poor friend
skipitem() in the same file. (If so, shame on you!)
skipitem() in the same file. (If so, shame on you!)
This function brute-force tests all** ASCII characters (1 to 127
With a few exceptions**, this function brute-force tests all
inclusive) as format units, checking to see that
printable ASCII*** characters (32 to 126 inclusive) as format units,
PyArg_ParseTupleAndKeywords() return consistent errors both when
checking to see that PyArg_ParseTupleAndKeywords() return consistent
the unit is attempted to be used and when it is skipped. If the
errors both when the unit is attempted to be used and when it is
format unit doesn't exist, we'll get one of two specific error
skipped. If the format unit doesn't exist, we'll get one of two
messages (one for used, one for skipped); if it does exist we
specific error messages (one for used, one for skipped); if it does
*won't* get that error--we'll get either no error or some other
exist we *won't* get that error--we'll get either no error or some
error. If we get the "does not exist" error for one test and
other error. If we get the specific "does not exist" error for one
not for the other, there's a mismatch, and the test fails.
test and not for the other, there's a mismatch, and the test fails.
** Okay, it actually skips some ASCII characters. Some characters
** Some format units have special funny semantics and it would
have special funny semantics, and it would be difficult to
be difficult to accomodate them here. Since these are all
accomodate them here.
well-established and properly skipped in skipitem() we can
get away with not testing them--this test is really intended
to catch *new* format units.
*** Python C source files must be ASCII. Therefore it's impossible
to have non-ASCII format units.
"""
"""
empty_tuple
=
()
empty_tuple
=
()
tuple_1
=
(
0
,)
tuple_1
=
(
0
,)
dict_b
=
{
'b'
:
1
}
dict_b
=
{
'b'
:
1
}
keywords
=
[
"a"
,
"b"
]
keywords
=
[
"a"
,
"b"
]
# Python C source files must be ASCII,
for
i
in
range
(
32
,
127
):
# therefore we'll never have a format unit > 127
for
i
in
range
(
1
,
128
):
c
=
chr
(
i
)
c
=
chr
(
i
)
# skip non-printable characters, no one is insane enough to define
# one as a format unit
# skip parentheses, the error reporting is inconsistent about them
# skip parentheses, the error reporting is inconsistent about them
# skip 'e', it's always a two-character code
# skip 'e', it's always a two-character code
# skip '|' and '$', they don't represent arguments anyway
# skip '|' and '$', they don't represent arguments anyway
if
(
not
c
.
isprintable
())
or
(
c
in
'()e|$'
)
:
if
c
in
'()e|$'
:
continue
continue
# test the format unit when not skipped
# test the format unit when not skipped
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment