diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2023-03-07 09:02:53 +0100 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2023-03-07 09:02:53 +0100 |
commit | d883ccdec11dabc41e43e98ff4e12da5649e6316 (patch) | |
tree | ced233ec80447f0ea44496531c8a95e6669a0aa7 | |
parent | 3397705da036bb2df4a5b8b4bf08dbad7bdb409f (diff) | |
download | cython-d883ccdec11dabc41e43e98ff4e12da5649e6316.tar.gz |
Allow Py3.12 AttributeError suggestions in doctest output.
-rw-r--r-- | tests/run/special_methods_T561.pyx | 12 | ||||
-rw-r--r-- | tests/run/special_methods_T561_py3.pyx | 43 |
2 files changed, 26 insertions, 29 deletions
diff --git a/tests/run/special_methods_T561.pyx b/tests/run/special_methods_T561.pyx index e5d1ec5bc..1c5f7ceb1 100644 --- a/tests/run/special_methods_T561.pyx +++ b/tests/run/special_methods_T561.pyx @@ -49,10 +49,10 @@ __doc__ = u""" >>> g01 = object.__getattribute__(GetAttr(), '__getattribute__') >>> g01('attr') GetAttr getattr 'attr' - >>> g10 = object.__getattribute__(GetAttribute(), '__getattr__') + >>> g10 = object.__getattribute__(GetAttribute(), '__getattr__') # doctest: +ELLIPSIS Traceback (most recent call last): ... - AttributeError: 'special_methods_T561.GetAttribute' object has no attribute '__getattr__' + AttributeError: 'special_methods_T561.GetAttribute' object has no attribute '__getattr__'... >>> g11 = object.__getattribute__(GetAttribute(), '__getattribute__') >>> g11('attr') GetAttribute getattribute 'attr' @@ -62,15 +62,15 @@ __doc__ = u""" >>> sa_setattr('foo', 'bar') SetAttr setattr 'foo' 'bar' >>> sa_delattr = SetAttr().__delattr__ - >>> sa_delattr('foo') + >>> sa_delattr('foo') # doctest: +ELLIPSIS Traceback (most recent call last): ... - AttributeError: 'special_methods_T561.SetAttr' object has no attribute 'foo' + AttributeError: 'special_methods_T561.SetAttr' object has no attribute 'foo'... >>> da_setattr = DelAttr().__setattr__ - >>> da_setattr('foo', 'bar') + >>> da_setattr('foo', 'bar') # doctest: +ELLIPSIS Traceback (most recent call last): ... - AttributeError: 'special_methods_T561.DelAttr' object has no attribute 'foo' + AttributeError: 'special_methods_T561.DelAttr' object has no attribute 'foo'... >>> da_delattr = DelAttr().__delattr__ >>> da_delattr('foo') DelAttr delattr 'foo' diff --git a/tests/run/special_methods_T561_py3.pyx b/tests/run/special_methods_T561_py3.pyx index 932002254..b766591d8 100644 --- a/tests/run/special_methods_T561_py3.pyx +++ b/tests/run/special_methods_T561_py3.pyx @@ -7,47 +7,44 @@ __doc__ = u""" >>> vs0 = VerySpecial(0) VS __init__ 0 + >>> # Python 3 does not use __cmp__, so any provided __cmp__ method is >>> # discarded under Python 3. - >>> vs0_cmp = vs0.__cmp__ + >>> vs0_cmp = vs0.__cmp__ # doctest: +ELLIPSIS Traceback (most recent call last): - ... - AttributeError: 'special_methods_T561_py3.VerySpecial' object has no attribute '__cmp__' + AttributeError: 'special_methods_T561_py3.VerySpecial' object has no attribute '__cmp__'... + >>> # Python 3 does not use __div__ or __idiv__, so these methods are >>> # discarded under Python 3. - >>> vs0_div = vs0.__div__ + >>> vs0_div = vs0.__div__ # doctest: +ELLIPSIS Traceback (most recent call last): - ... - AttributeError: 'special_methods_T561_py3.VerySpecial' object has no attribute '__div__' - >>> vs0_rdiv = vs0.__rdiv__ + AttributeError: 'special_methods_T561_py3.VerySpecial' object has no attribute '__div__'... + >>> vs0_rdiv = vs0.__rdiv__ # doctest: +ELLIPSIS Traceback (most recent call last): - ... - AttributeError: 'special_methods_T561_py3.VerySpecial' object has no attribute '__rdiv__' - >>> vs0_idiv = vs0.__idiv__ + AttributeError: 'special_methods_T561_py3.VerySpecial' object has no attribute '__rdiv__'... + >>> vs0_idiv = vs0.__idiv__ # doctest: +ELLIPSIS Traceback (most recent call last): - ... - AttributeError: 'special_methods_T561_py3.VerySpecial' object has no attribute '__idiv__' + AttributeError: 'special_methods_T561_py3.VerySpecial' object has no attribute '__idiv__'... + >>> # Python 3 does not use __oct__ or __hex__, so these methods are >>> # discarded under Python 3. - >>> vs0_oct = vs0.__oct__ + >>> vs0_oct = vs0.__oct__ # doctest: +ELLIPSIS Traceback (most recent call last): - ... - AttributeError: 'special_methods_T561_py3.VerySpecial' object has no attribute '__oct__' - >>> vs0_hex = vs0.__hex__ + AttributeError: 'special_methods_T561_py3.VerySpecial' object has no attribute '__oct__'... + >>> vs0_hex = vs0.__hex__ # doctest: +ELLIPSIS Traceback (most recent call last): - ... - AttributeError: 'special_methods_T561_py3.VerySpecial' object has no attribute '__hex__' + AttributeError: 'special_methods_T561_py3.VerySpecial' object has no attribute '__hex__'... + >>> # Python 3 does not use __long__; if you define __long__ but not >>> # __int__, the __long__ definition will be used for __int__. - >>> Ll = Long().__long__ + >>> Ll = Long().__long__ # doctest: +ELLIPSIS Traceback (most recent call last): - ... - AttributeError: 'special_methods_T561_py3.Long' object has no attribute '__long__' + AttributeError: 'special_methods_T561_py3.Long' object has no attribute '__long__'... >>> Li = Long().__int__ >>> Li() Long __long__ - >>> # As of Python 3, defining __nonzero__ gives you a __bool__ method - >>> # instead. + + >>> # As of Python 3, defining __nonzero__ gives you a __bool__ method instead. >>> vs0_bool = vs0.__bool__ >>> vs0_bool() VS __nonzero__ 0 |