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
Boxiang Sun
cython
Commits
a13dfd84
Commit
a13dfd84
authored
Feb 22, 2014
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extend tuple tests to cover recent C code simplifications
parent
52b2007b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
0 deletions
+49
-0
tests/run/tuple.pyx
tests/run/tuple.pyx
+49
-0
No files found.
tests/run/tuple.pyx
View file @
a13dfd84
cimport
cython
def
f
(
obj1
,
obj2
,
obj3
,
obj4
,
obj5
):
"""
>>> f(1,2,3,4,5)
...
...
@@ -7,6 +10,7 @@ def f(obj1, obj2, obj3, obj4, obj5):
obj1
=
()
return
obj1
def
g
(
obj1
,
obj2
,
obj3
,
obj4
,
obj5
):
"""
>>> g(1,2,3,4,5)
...
...
@@ -16,6 +20,7 @@ def g(obj1, obj2, obj3, obj4, obj5):
obj1
=
(
obj2
,)
return
obj1
def
h
(
obj1
,
obj2
,
obj3
,
obj4
,
obj5
):
"""
>>> h(1,2,3,4,5)
...
...
@@ -26,6 +31,7 @@ def h(obj1, obj2, obj3, obj4, obj5):
obj1
=
obj2
,
obj3
return
obj1
def
j
(
obj1
,
obj2
,
obj3
,
obj4
,
obj5
):
"""
>>> j(1,2,3,4,5)
...
...
@@ -37,6 +43,7 @@ def j(obj1, obj2, obj3, obj4, obj5):
obj1
=
(
obj2
,
obj3
,
obj4
)
return
obj1
def
k
(
obj1
,
obj2
,
obj3
,
obj4
,
obj5
):
"""
>>> k(1,2,3,4,5)
...
...
@@ -49,6 +56,7 @@ def k(obj1, obj2, obj3, obj4, obj5):
obj1
=
(
obj2
,
obj3
,
obj4
,)
return
obj1
def
l
(
obj1
,
obj2
,
obj3
,
obj4
,
obj5
):
"""
>>> l(1,2,3,4,5)
...
...
@@ -62,6 +70,7 @@ def l(obj1, obj2, obj3, obj4, obj5):
obj1
=
17
,
42
,
88
return
obj1
def
tuple_none
():
"""
>>> tuple_none() # doctest: +ELLIPSIS
...
...
@@ -70,6 +79,7 @@ def tuple_none():
"""
return
tuple
(
None
)
def
tuple_none_list
():
"""
>>> tuple_none_list() # doctest: +ELLIPSIS
...
...
@@ -78,3 +88,42 @@ def tuple_none_list():
"""
cdef
list
none
=
None
return
tuple
(
none
)
@
cython
.
test_fail_if_path_exists
(
'//SimpleCallNode'
,
'//PythonCapiCallNode'
)
def
tuple_of_tuple_literal
():
"""
>>> tuple_of_tuple_literal()
(1, 2, 3)
"""
return
tuple
(
tuple
(
tuple
((
1
,
2
,
3
))))
@
cython
.
test_fail_if_path_exists
(
'//SimpleCallNode'
,
'//PythonCapiCallNode'
)
def
tuple_of_args_tuple
(
*
args
):
"""
>>> tuple_of_args_tuple(1,2,3)
(1, 2, 3)
"""
return
tuple
(
tuple
(
tuple
(
args
)))
@
cython
.
test_fail_if_path_exists
(
'//SimpleCallNode//SimpleCallNode'
,
'//PythonCapiCallNode'
)
def
tuple_of_tuple_or_none
(
tuple
x
):
"""
>>> tuple_of_tuple_or_none((1,2,3))
(1, 2, 3)
>>> tuple_of_tuple_or_none(None) # doctest: +ELLIPSIS
Traceback (most recent call last):
TypeError: ...iterable...
"""
return
tuple
(
tuple
(
tuple
(
x
)))
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