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
Gwenaël Samain
cython
Commits
b5a7028a
Commit
b5a7028a
authored
Jun 14, 2014
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add test for Py-list to struct conversion
parent
e2da9a79
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
tests/run/struct_conversion.pyx
tests/run/struct_conversion.pyx
+23
-0
No files found.
tests/run/struct_conversion.pyx
View file @
b5a7028a
...
@@ -35,6 +35,29 @@ def test_dict_construction(x, y, color):
...
@@ -35,6 +35,29 @@ def test_dict_construction(x, y, color):
cdef
Point
p
=
{
'color'
:
color
,
'x'
:
x
,
'y'
:
y
}
cdef
Point
p
=
{
'color'
:
color
,
'x'
:
x
,
'y'
:
y
}
return
p
return
p
def
test_list_construction
(
x
,
y
,
color
):
"""
>>> sorted(test_list_construction(4, 5, 64).items())
[('color', 64), ('x', 4.0), ('y', 5.0)]
>>> try: test_list_construction("foo", 5, 64)
... except TypeError: pass
"""
cdef
Point
p
=
[
x
,
y
,
color
]
return
p
'''
# FIXME: make this work
def test_tuple_construction(x, y, color):
"""
>>> sorted(test_tuple_construction(4, 5, 64).items())
[('color', 64), ('x', 4.0), ('y', 5.0)]
>>> try: test_tuple_construction("foo", 5, 64)
... except TypeError: pass
"""
cdef Point p = (x, y, color)
return p
'''
cdef
union
int_or_float
:
cdef
union
int_or_float
:
int
n
int
n
double
x
double
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