summaryrefslogtreecommitdiff
path: root/tests/errors/e_cdef_keywords_T241.pyx
blob: 28a2783fe49a829cbacd8170e4c9c5326f93c9a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# ticket: t241
# mode: error

cdef some_function(x, y):
    pass

cdef class A:
    cdef some_method(self, x, y=1):
        pass

from libc.string cimport strcmp

cdef extern from "string.h":
    char *strstr(char*, char*)


# ok
some_function(1, 2)
some_function(1, y=2)

# nok
some_function(1, x=1)
some_function(1, x=2, y=2)
some_function(1, y=2, z=3)
some_function(1, z=3)
some_function(1, 2, z=3)
some_function(x=1, y=2, z=3)
some_function(x=1, y=2, x=1)
some_function(x=1, y=2, x=1, z=3)

cdef A a = A()
# ok
a.some_method(1)
a.some_method(1, 2)
a.some_method(1, y=2)
a.some_method(x=1, y=2)

# nok
a.some_method(1, x=1)
a.some_method(1, 2, x=1)
a.some_method(1, 2, y=2)
a.some_method(1, 2, x=1, y=2)
a.some_method(1, 2, y=2, x=1)
a.some_method(1, y=2, x=1)
a.some_method(1, 2, z=3)
a.some_method(1, y=2, z=3)
a.some_method(x=1, x=1)
a.some_method(x=1, x=1, y=2)
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"""
22:17: argument 'x' passed twice
23:17: argument 'x' passed twice
24:22: C function got unexpected keyword argument 'z'
25:17: C function got unexpected keyword argument 'z'
26:20: C function got unexpected keyword argument 'z'
27:24: C function got unexpected keyword argument 'z'
28:24: argument 'x' passed twice
29:24: argument 'x' passed twice
29:29: C function got unexpected keyword argument 'z'

39:17: argument 'x' passed twice
40:20: argument 'x' passed twice
41:20: argument 'y' passed twice
42:20: argument 'x' passed twice
42:25: argument 'y' passed twice
43:20: argument 'y' passed twice
43:25: argument 'x' passed twice
44:22: argument 'x' passed twice
45:20: C function got unexpected keyword argument 'z'
46:22: C function got unexpected keyword argument 'z'
47:19: argument 'x' passed twice
48:19: argument 'x' passed twice
49:24: argument 'x' passed twice

58:14: argument 's1' passed twice
59:24: argument 's1' passed twice
60:27: argument 's1' passed twice
61:27: argument 's2' passed twice

67:14: C function got unexpected keyword argument 'char'
68:24: C function got unexpected keyword argument 'char'
"""