From b34b20d4f670b965a643c540823b4698297cc4d0 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Sun, 8 Mar 2009 14:18:27 +0100 Subject: [PATCH] test case for ticket #18 --- .../bugs/class_attribute_init_values_T18.pyx | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 tests/bugs/class_attribute_init_values_T18.pyx diff --git a/tests/bugs/class_attribute_init_values_T18.pyx b/tests/bugs/class_attribute_init_values_T18.pyx new file mode 100644 index 00000000..7372275a --- /dev/null +++ b/tests/bugs/class_attribute_init_values_T18.pyx @@ -0,0 +1,55 @@ +__doc__ = u""" +>>> f = PyFoo() +>>> print(f.bar) +5 +>>> print(f.baz) +someval + +>>> f = MyPyFoo() +>>> print(f.bar) +7 +>>> print(f.baz) +anotherval + +>>> f = CyFoo() +>>> print(f.bar) +5 +>>> print(f.baz) +anotherval + +>>> f = MyCyFoo() +>>> print(f.bar) +7 +>>> print(f.baz) +anotherval + +>>> f = AnotherFoo() +>>> print(f.bar) +8 +>>> print(f.baz) +yetanotherval +""" + +# this works: + +class PyFoo(object): + bar = 5 + baz = u"someval" + +class MyPyFoo(PyFoo): + bar = 7 + baz = u"anotherval" + +# this doesn't: + +cdef class CyFoo: + cdef public int bar = 5 + cdef public object baz = u"someval" + +cdef class MyCyFoo(CyFoo): + cdef public int bar = 7 + cdef public object baz = u"anotherval" + +class AnotherFoo(CyFoo): + bar = 8 + baz = u"yetanotherval" -- 2.26.2