cython
1# mode: run
2# tag: cpp, werror
3
4cdef extern from "cpp_namespaces_helper.h" namespace "A":
5ctypedef int A_t
6cdef struct S:
7double x
8A_t k
9A_t A_func(A_t first, A_t)
10cdef void f(A_t)
11
12cdef extern from "cpp_namespaces_helper.h" namespace "outer":
13int outer_value
14
15cdef extern from "cpp_namespaces_helper.h" namespace "outer::inner":
16int inner_value
17
18def test_function(x, y):
19"""
20>>> test_function(1, 2)
213
22>>> test_function(9, 16)
2325
24"""
25return A_func(x, y)
26
27def test_nested():
28"""
29>>> test_nested()
3010
31100
32"""
33print outer_value
34print inner_value
35
36def test_typedef(A_t a):
37"""
38>>> test_typedef(3)
393
40"""
41return a
42
43def test_convert_struct(S s):
44"""
45>>> py_value = {'x': 3.5, 'k': 10}
46>>> test_convert_struct(py_value) == py_value
47True
48"""
49return s
50