From 64823ccf4f4223e167d34f99867c1eeb32572af8 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Fri, 23 May 2008 20:07:44 +0200 Subject: [PATCH] simple test case to emulate class methods as function attributes --- tests/run/classmethod.pyx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/run/classmethod.pyx diff --git a/tests/run/classmethod.pyx b/tests/run/classmethod.pyx new file mode 100644 index 00000000..e8004b99 --- /dev/null +++ b/tests/run/classmethod.pyx @@ -0,0 +1,20 @@ +__doc__ = u""" +>>> class1.plus1(1) +2 +>>> class2.plus1(1) +2 +>>> class3.plus1(1) +2 +""" + +def f_plus(a): + return a + 1 + +class class1: + plus1 = f_plus + +class class2(object): + plus1 = f_plus + +cdef class class3: + plus1 = f_plus -- 2.26.2