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
ff1c8833
Commit
ff1c8833
authored
Feb 07, 2013
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extend cdef function kwargs tests to include functions from the libc standard declarations
parent
a62cbf30
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
26 deletions
+78
-26
tests/errors/e_cdef_keywords_T241.pyx
tests/errors/e_cdef_keywords_T241.pyx
+56
-22
tests/run/simplify_calls.pyx
tests/run/simplify_calls.pyx
+22
-4
No files found.
tests/errors/e_cdef_keywords_T241.pyx
View file @
ff1c8833
...
@@ -8,6 +8,12 @@ cdef class A:
...
@@ -8,6 +8,12 @@ cdef class A:
cdef
some_method
(
self
,
x
,
y
=
1
):
cdef
some_method
(
self
,
x
,
y
=
1
):
pass
pass
from
libc.string
cimport
strcmp
cdef
extern
from
"string.h"
:
char
*
strstr
(
char
*
,
char
*
)
# ok
# ok
some_function
(
1
,
2
)
some_function
(
1
,
2
)
some_function
(
1
,
y
=
2
)
some_function
(
1
,
y
=
2
)
...
@@ -42,28 +48,56 @@ a.some_method(x=1, x=1)
...
@@ -42,28 +48,56 @@ a.some_method(x=1, x=1)
a
.
some_method
(
x
=
1
,
x
=
1
,
y
=
2
)
a
.
some_method
(
x
=
1
,
x
=
1
,
y
=
2
)
a
.
some_method
(
x
=
1
,
y
=
2
,
x
=
1
)
a
.
some_method
(
x
=
1
,
y
=
2
,
x
=
1
)
# ok
strcmp
(
"abc"
,
"cde"
)
strcmp
(
"abc"
,
S2
=
"cde"
)
strcmp
(
S1
=
"abc"
,
S2
=
"cde"
)
strcmp
(
S2
=
"cde"
,
S1
=
"abc"
)
# nok
strcmp
(
"abc"
,
S1
=
"cde"
)
strcmp
(
"abc"
,
S2
=
"cde"
,
S1
=
"cde"
)
strcmp
(
S1
=
"abc"
,
S2
=
"cde"
,
S1
=
"cde"
)
strcmp
(
S2
=
"cde"
,
S1
=
"abc"
,
S2
=
"cde"
)
# ok
strstr
(
"abc"
,
"abcdef"
)
# nok
strstr
(
"abc"
,
char
=
"abcdef"
)
strstr
(
"abc"
,
"abcdef"
,
char
=
"xyz"
)
_ERRORS
=
u"""
_ERRORS
=
u"""
16:18: argument 'x' passed twice
22:18: argument 'x' passed twice
17:18: argument 'x' passed twice
23:18: argument 'x' passed twice
18:23: C function got unexpected keyword argument 'z'
24:23: C function got unexpected keyword argument 'z'
19:18: C function got unexpected keyword argument 'z'
25:18: C function got unexpected keyword argument 'z'
20:21: C function got unexpected keyword argument 'z'
26:21: C function got unexpected keyword argument 'z'
21:25: C function got unexpected keyword argument 'z'
27:25: C function got unexpected keyword argument 'z'
22:25: argument 'x' passed twice
28:25: argument 'x' passed twice
23:25: argument 'x' passed twice
29:25: argument 'x' passed twice
23:30: C function got unexpected keyword argument 'z'
29:30: C function got unexpected keyword argument 'z'
33:18: argument 'x' passed twice
34:21: argument 'x' passed twice
39:18: argument 'x' passed twice
35:21: argument 'y' passed twice
40:21: argument 'x' passed twice
36:21: argument 'x' passed twice
41:21: argument 'y' passed twice
36:26: argument 'y' passed twice
42:21: argument 'x' passed twice
37:21: argument 'y' passed twice
42:26: argument 'y' passed twice
37:26: argument 'x' passed twice
43:21: argument 'y' passed twice
38:23: argument 'x' passed twice
43:26: argument 'x' passed twice
39:21: C function got unexpected keyword argument 'z'
44:23: argument 'x' passed twice
40:23: C function got unexpected keyword argument 'z'
45:21: C function got unexpected keyword argument 'z'
41:20: argument 'x' passed twice
46:23: C function got unexpected keyword argument 'z'
42:20: argument 'x' passed twice
47:20: argument 'x' passed twice
43:25: argument 'x' passed twice
48:20: argument 'x' passed twice
49:25: argument 'x' passed twice
58:16: argument 'S1' passed twice
59:26: argument 'S1' passed twice
60:29: argument 'S1' passed twice
61:29: argument 'S2' passed twice
67:18: C function got unexpected keyword argument 'char'
68:28: C function got unexpected keyword argument 'char'
"""
"""
tests/run/simplify_calls.pyx
View file @
ff1c8833
cimport
cython
cimport
cython
from
libc.string
cimport
strstr
cdef
cfunc
(
a
,
b
,
c
,
d
):
cdef
cfunc
(
a
,
b
,
c
,
d
):
return
(
a
,
b
,
c
,
d
)
return
(
a
,
b
,
c
,
d
)
...
@@ -76,8 +78,8 @@ def cpfunc_some_keywords():
...
@@ -76,8 +78,8 @@ def cpfunc_some_keywords():
return
cpfunc
(
1
,
2
,
c
=
3
,
d
=
4
)
return
cpfunc
(
1
,
2
,
c
=
3
,
d
=
4
)
#
@cython.test_fail_if_path_exists('//GeneralCallNode')
@
cython
.
test_fail_if_path_exists
(
'//GeneralCallNode'
)
#
@cython.test_assert_path_exists('//SimpleCallNode')
@
cython
.
test_assert_path_exists
(
'//SimpleCallNode'
)
def
cpfunc_some_keywords_unordered
():
def
cpfunc_some_keywords_unordered
():
"""
"""
>>> cpfunc_some_keywords_unordered()
>>> cpfunc_some_keywords_unordered()
...
@@ -86,8 +88,8 @@ def cpfunc_some_keywords_unordered():
...
@@ -86,8 +88,8 @@ def cpfunc_some_keywords_unordered():
return
cpfunc
(
1
,
2
,
d
=
4
,
c
=
3
)
return
cpfunc
(
1
,
2
,
d
=
4
,
c
=
3
)
#
@cython.test_fail_if_path_exists('//GeneralCallNode')
@
cython
.
test_fail_if_path_exists
(
'//GeneralCallNode'
)
#
@cython.test_assert_path_exists('//SimpleCallNode')
@
cython
.
test_assert_path_exists
(
'//SimpleCallNode'
)
def
cpfunc_some_keywords_unordered_sideeffect
():
def
cpfunc_some_keywords_unordered_sideeffect
():
"""
"""
>>> del sideeffect[:]
>>> del sideeffect[:]
...
@@ -97,3 +99,19 @@ def cpfunc_some_keywords_unordered_sideeffect():
...
@@ -97,3 +99,19 @@ def cpfunc_some_keywords_unordered_sideeffect():
[4, 3]
[4, 3]
"""
"""
return
cpfunc
(
1
,
2
,
d
=
side_effect
(
4
),
c
=
side_effect
(
3
))
return
cpfunc
(
1
,
2
,
d
=
side_effect
(
4
),
c
=
side_effect
(
3
))
@
cython
.
test_fail_if_path_exists
(
'//GeneralCallNode'
)
@
cython
.
test_assert_path_exists
(
'//SimpleCallNode'
)
def
libc_strstr
():
"""
>>> libc_strstr()
(True, True, True, True, True)
"""
return
(
strstr
(
"xabcy"
,
"abc"
)
is
not
NULL
,
strstr
(
"abc"
,
"xabcy"
)
is
NULL
,
strstr
(
NEEDLE
=
"abc"
,
HAYSTACK
=
"xabcz"
)
is
not
NULL
,
strstr
(
NEEDLE
=
"xabcz"
,
HAYSTACK
=
"abc"
)
is
NULL
,
strstr
(
HAYSTACK
=
"abc"
,
NEEDLE
=
"xabcz"
)
is
NULL
,
)
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