summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorda-woods <dw-git@d-woods.co.uk>2022-09-03 16:51:45 +0100
committerda-woods <dw-git@d-woods.co.uk>2022-09-03 16:53:05 +0100
commit3eb193be37f47a894737150c6833f707d729362d (patch)
treea2ab34509216f3438aa5fe6b8878f14a12834bf3
parentbf4858d6de33609738a7334dd58546c9ab137248 (diff)
downloadcython-3eb193be37f47a894737150c6833f707d729362d.tar.gz
Disable memview test on Py2
-rw-r--r--tests/run/extra_patma.pyx22
1 files changed, 16 insertions, 6 deletions
diff --git a/tests/run/extra_patma.pyx b/tests/run/extra_patma.pyx
index 4482b2bf4..a712864f5 100644
--- a/tests/run/extra_patma.pyx
+++ b/tests/run/extra_patma.pyx
@@ -5,6 +5,21 @@
cimport cython
import array
+import sys
+
+__doc__ = ""
+
+if sys.version_info[0] > 2:
+ __doc__ += """
+ array.array doesn't have the buffer protocol in Py2 and
+ this doesn't really feel worth working around to test
+ >>> print(test_memoryview(array.array('i', [0, 1, 2])))
+ a 1
+ >>> print(test_memoryview(array.array('i', [])))
+ b
+ >>> print(test_memoryview(array.array('i', [5])))
+ c [5]
+ """
# goes via .shape instead
@cython.test_fail_if_path_exists("//CallNode//NameNode[@name = 'len']")
@@ -12,14 +27,8 @@ import array
@cython.test_fail_if_path_exists("//PythonCapiCallNode//PythonCapiFunctionNode[@cname = '__Pyx_MatchCase_IsSequence']")
def test_memoryview(int[:] x):
"""
- >>> print(test_memoryview(array.array('i', [0, 1, 2])))
- a 1
- >>> print(test_memoryview(array.array('i', [])))
- b
>>> print(test_memoryview(None))
no!
- >>> print(test_memoryview(array.array('i', [5])))
- c [5]
"""
match x:
case [0, y, 2]:
@@ -71,3 +80,4 @@ def test_ctuple_to_sequence((int, int) x):
case [a, b]:
assert cython.typeof(a) == "int", cython.typeof(a) # test that types have inferred
return a, b
+