diff options
author | da-woods <dw-git@d-woods.co.uk> | 2021-10-18 11:10:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-18 12:10:05 +0200 |
commit | 5f820eda5d54c29922df704221bb3ec4c9f74c0d (patch) | |
tree | 52f6799380cafb168e66e2ab8d546a0494ca1381 | |
parent | 4df1103bd30143ce022b07f98a2f62678d417e92 (diff) | |
download | cython-5f820eda5d54c29922df704221bb3ec4c9f74c0d.tar.gz |
Fix fused.__self__ tests on PyPy (GH-4417)
PyPy v7.3.6 looks to have added a helpful "did you mean..." to the AttributeError exception. It's currently tripping up these tests.
-rw-r--r-- | tests/run/function_self.py | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/tests/run/function_self.py b/tests/run/function_self.py index e4796c46b..938810491 100644 --- a/tests/run/function_self.py +++ b/tests/run/function_self.py @@ -27,10 +27,11 @@ def fused(x): #>>> hasattr(fused, "__self__") # FIXME this fails for fused functions #False - >>> fused.__self__ # but this is OK + # but this is OK: + >>> fused.__self__ #doctest: +ELLIPSIS Traceback (most recent call last): ... - AttributeError: 'function' object has no attribute '__self__' + AttributeError: 'function' object has no attribute '__self__'... """ def nested_in_fused(y): return x+y @@ -63,26 +64,28 @@ if sys.version_info[0] > 2 or cython.compiled: __doc__ += """ >>> hasattr(C.regular, "__self__") # __self__==None on pure-python 2 False - >>> C.fused.__self__ # returns None on pure-python 2 + + # returns None on pure-python 2 + >>> C.fused.__self__ #doctest: +ELLIPSIS Traceback (most recent call last): ... - AttributeError: 'function' object has no attribute '__self__' + AttributeError: 'function' object has no attribute '__self__'... """ if cython.compiled: __doc__ = """ - >>> fused['double'].__self__ + >>> fused['double'].__self__ #doctest: +ELLIPSIS Traceback (most recent call last): ... - AttributeError: 'function' object has no attribute '__self__' + AttributeError: 'function' object has no attribute '__self__'... - >>> C.fused['double'].__self__ + >>> C.fused['double'].__self__ #doctest: +ELLIPSIS Traceback (most recent call last): ... - AttributeError: 'function' object has no attribute '__self__' + AttributeError: 'function' object has no attribute '__self__'... >>> c = C() - >>> c.fused['double'].__self__ is c + >>> c.fused['double'].__self__ is c #doctest: +ELLIPSIS True # The PR that changed __self__ also changed how __doc__ is set up slightly |