• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1########## TestClass ##########
2# These utilities are for testing purposes
3
4cdef extern from *:
5    cdef object __pyx_test_dep(object)
6
7@cname('__pyx_TestClass')
8cdef class TestClass(object):
9    cdef public int value
10
11    def __init__(self, int value):
12        self.value = value
13
14    def __str__(self):
15        return 'TestClass(%d)' % self.value
16
17    cdef cdef_method(self, int value):
18        print 'Hello from cdef_method', value
19
20    cpdef cpdef_method(self, int value):
21        print 'Hello from cpdef_method', value
22
23    def def_method(self, int value):
24        print 'Hello from def_method', value
25
26    @cname('cdef_cname')
27    cdef cdef_cname_method(self, int value):
28        print "Hello from cdef_cname_method", value
29
30    @cname('cpdef_cname')
31    cpdef cpdef_cname_method(self, int value):
32        print "Hello from cpdef_cname_method", value
33
34    @cname('def_cname')
35    def def_cname_method(self, int value):
36        print "Hello from def_cname_method", value
37
38@cname('__pyx_test_call_other_cy_util')
39cdef test_call(obj):
40    print 'test_call'
41    __pyx_test_dep(obj)
42
43@cname('__pyx_TestClass_New')
44cdef _testclass_new(int value):
45    return TestClass(value)
46
47########### TestDep ##########
48
49@cname('__pyx_test_dep')
50cdef test_dep(obj):
51    print 'test_dep', obj
52
53########## TestScope ##########
54
55@cname('__pyx_testscope')
56cdef object _testscope(int value):
57    return "hello from cython scope, value=%d" % value
58
59########## View.TestScope ##########
60
61@cname('__pyx_view_testscope')
62cdef object _testscope(int value):
63    return "hello from cython.view scope, value=%d" % value
64
65