Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xavier Thompson
cython
Commits
f81c0b0b
Commit
f81c0b0b
authored
Sep 17, 2011
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extended test case
parent
1a2d1558
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
10 deletions
+42
-10
tests/run/argerrors.py
tests/run/argerrors.py
+42
-10
No files found.
tests/run/argerrors.py
View file @
f81c0b0b
# mode: run
# tags: kwargs, argument unpacking
# This test validates the error handling in the different specialised
# code paths of the argument unpacking code. The have-kwargs and
# no-kwargs branches take different paths, so we always test with and
# without a keyword dict (even if it's empty).
def
test_single_arg
(
a
):
"""
>>> test_single_arg(1)
1
>>> test_single_arg() # doctest: +ELLIPSIS
>>> test_single_arg(1, **{})
1
>>> test_single_arg() # doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: ...
>>> test_single_arg(1,2) # doctest: +ELLIPSIS
>>> test_single_arg(1,2)
# doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: ...
>>> test_single_arg(
**{})
# doctest: +ELLIPSIS
>>> test_single_arg(
1,2, **{})
# doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: ...
>>> test_single_arg(*(), **{}) # doctest: +ELLIPSIS
>>> test_single_arg(**{}) # doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: ...
>>> test_single_arg(*(), **{}) # doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: ...
>>> test_single_arg(**{'b':2}) # doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: ...
>>> test_single_arg(**{'a':1, 'b':2}) # doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: ...
"""
...
...
@@ -23,22 +40,37 @@ def test_two_args(a,b):
"""
>>> test_two_args(1,2)
(1, 2)
>>> test_two_args() # doctest: +ELLIPSIS
>>> test_two_args(1,2, **{})
(1, 2)
>>> test_two_args(1,**{'b':2})
(1, 2)
>>> test_two_args(**{'a':1, 'b':2})
(1, 2)
>>> test_two_args() # doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: ...
>>> test_two_args(1) # doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: ...
>>> test_two_args(1, **{}) # doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: ...
>>> test_two_args(1,2,3) # doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: ...
>>> test_two_args(1
)
# doctest: +ELLIPSIS
>>> test_two_args(1
,2,3, **{})
# doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: ...
>>> test_two_args(
1,2,3)
# doctest: +ELLIPSIS
>>> test_two_args(
**{})
# doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: ...
>>> test_two_args(*
*{})
# doctest: +ELLIPSIS
>>> test_two_args(*
(), **{})
# doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: ...
>>> test_two_args(
1, **{})
# doctest: +ELLIPSIS
>>> test_two_args(
**{'a':1})
# doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: ...
>>> test_two_args(*
(), **{})
# doctest: +ELLIPSIS
>>> test_two_args(*
*{'a':1, 'b':2, 'c':3})
# doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: ...
"""
...
...
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