diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2021-04-16 08:41:28 +0200 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2021-04-16 08:41:28 +0200 |
commit | b643850a12f2065ce71ddcea5b105c28444fbce9 (patch) | |
tree | 53b11d600a1e2f4923afb3400f8d1fc7169e6184 | |
parent | 2934195c1a4e5ce2a29ca7616eed0ab1d9f40644 (diff) | |
download | cython-b643850a12f2065ce71ddcea5b105c28444fbce9.tar.gz |
Disable a test in Py<3.8 when using type specs, since it requires a CPython bug fix.
-rw-r--r-- | tests/run/special_methods_T561.pyx | 57 |
1 files changed, 33 insertions, 24 deletions
diff --git a/tests/run/special_methods_T561.pyx b/tests/run/special_methods_T561.pyx index d585f35d0..5995c3fdd 100644 --- a/tests/run/special_methods_T561.pyx +++ b/tests/run/special_methods_T561.pyx @@ -55,30 +55,6 @@ __doc__ = u""" AttributeError: 'special_methods_T561.GetAttribute' object has no attribute '__getattr__' >>> g11 = object.__getattribute__(GetAttribute(), '__getattribute__') >>> g11('attr') - GetAttribute getattribute 'attr' - >>> # If you define either setattr or delattr, you get wrapper objects - >>> # for both methods. (This behavior is unchanged by #561.) - >>> sa_setattr = SetAttr().__setattr__ - >>> sa_setattr('foo', 'bar') - SetAttr setattr 'foo' 'bar' - >>> sa_delattr = SetAttr().__delattr__ - >>> sa_delattr('foo') - Traceback (most recent call last): - ... - AttributeError: 'special_methods_T561.SetAttr' object has no attribute 'foo' - >>> da_setattr = DelAttr().__setattr__ - >>> da_setattr('foo', 'bar') - Traceback (most recent call last): - ... - AttributeError: 'special_methods_T561.DelAttr' object has no attribute 'foo' - >>> da_delattr = DelAttr().__delattr__ - >>> da_delattr('foo') - DelAttr delattr 'foo' - >>> sda_setattr = SetDelAttr().__setattr__ - >>> sda_setattr('foo', 'bar') - SetDelAttr setattr 'foo' 'bar' - >>> sda_delattr = SetDelAttr().__delattr__ - >>> sda_delattr('foo') SetDelAttr delattr 'foo' >>> # If you define either set or delete, you get wrapper objects >>> # for both methods. (This behavior is unchanged by #561.) @@ -119,6 +95,39 @@ if sys.version_info >= (2,5): VS __index__ 0 """ +cdef extern from *: + # type specs require a bug fix in Py3.8+ for some of these tests. + const int CYTHON_USE_TYPE_SPECS + +if not CYTHON_USE_TYPE_SPECS or sys.version_info >= (3,8): + __doc__ += u""" + GetAttribute getattribute 'attr' + >>> # If you define either setattr or delattr, you get wrapper objects + >>> # for both methods. (This behavior is unchanged by #561.) + >>> sa_setattr = SetAttr().__setattr__ + >>> sa_setattr('foo', 'bar') + SetAttr setattr 'foo' 'bar' + >>> sa_delattr = SetAttr().__delattr__ + >>> sa_delattr('foo') + Traceback (most recent call last): + ... + AttributeError: 'special_methods_T561.SetAttr' object has no attribute 'foo' + >>> da_setattr = DelAttr().__setattr__ + >>> da_setattr('foo', 'bar') + Traceback (most recent call last): + ... + AttributeError: 'special_methods_T561.DelAttr' object has no attribute 'foo' + >>> da_delattr = DelAttr().__delattr__ + >>> da_delattr('foo') + DelAttr delattr 'foo' + >>> sda_setattr = SetDelAttr().__setattr__ + >>> sda_setattr('foo', 'bar') + SetDelAttr setattr 'foo' 'bar' + >>> sda_delattr = SetDelAttr().__delattr__ + >>> sda_delattr('foo') +""" + + cdef class VerySpecial: """ >>> vs0 = VerySpecial(0) |