summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2023-04-24 13:11:12 +0200
committerStefan Behnel <stefan_ml@behnel.de>2023-04-24 18:57:21 +0200
commit3ce72e1f0ee3c02ca1e3eb7385810ee4b5d5acee (patch)
treedab69214268b1185722f07d50afeec1077d17404
parent8e0d4df40d1bca3d44eb185f74d6f4d23be4b213 (diff)
downloadcython-3ce72e1f0ee3c02ca1e3eb7385810ee4b5d5acee.tar.gz
Move C-only test out of Python test file.
-rw-r--r--tests/run/pure.pyx53
-rw-r--r--tests/run/pure_py.py59
2 files changed, 53 insertions, 59 deletions
diff --git a/tests/run/pure.pyx b/tests/run/pure.pyx
index 23e41c77b..124f8d1cd 100644
--- a/tests/run/pure.pyx
+++ b/tests/run/pure.pyx
@@ -1,3 +1,6 @@
+# mode: run
+# tag: warnings
+
import cython
def test_sizeof():
@@ -182,3 +185,53 @@ def ext_type_string_ref(x: "ExtType"):
'ExtType'
"""
return cython.typeof(x)
+
+
+with cython.cdivision(True):
+
+ @cython.cdivision(False)
+ @cython.cdivision(True)
+ def test_override_reset(x: cython.int):
+ """
+ >>> test_override_reset(-3) # @cdivision(False)
+ -2
+ """
+ return x / 2
+
+ @cython.cdivision(True)
+ @cython.cdivision(False)
+ def test_override_set(x: cython.int):
+ """
+ >>> test_override_set(-5) # @cdivision(True)
+ -1
+ """
+ return x / 3
+
+ @cython.cdivision(True)
+ @cython.cdivision(False)
+ @cython.cdivision(True)
+ @cython.cdivision(False)
+ @cython.cdivision(False)
+ @cython.cdivision(False)
+ @cython.cdivision(True)
+ @cython.cdivision(False)
+ @cython.cdivision(True)
+ @cython.cdivision(True)
+ @cython.cdivision(True)
+ @cython.cdivision(False)
+ def test_override_set_repeated(x: cython.int):
+ """
+ >>> test_override_set_repeated(-5) # @cdivision(True)
+ -1
+ """
+ return x / 3
+
+
+_WARNINGS = """
+181:27: Strings should no longer be used for type declarations. Use 'cython.int' etc. directly.
+193:4: Directive does not change previous value (cdivision=True)
+213:4: Directive does not change previous value (cdivision=False)
+214:4: Directive does not change previous value (cdivision=False)
+218:4: Directive does not change previous value (cdivision=True)
+219:4: Directive does not change previous value (cdivision=True)
+"""
diff --git a/tests/run/pure_py.py b/tests/run/pure_py.py
index de53e2351..0cacf6429 100644
--- a/tests/run/pure_py.py
+++ b/tests/run/pure_py.py
@@ -1,5 +1,4 @@
# mode: run
-# tag: warnings
import sys
IS_PY2 = sys.version_info[0] < 3
@@ -605,61 +604,3 @@ def array_init_with_list():
x[12] = 42
return [x[10], x[12]]
-
-
-with cython.cdivision(True):
-
- @cython.cdivision(False)
- @cython.cdivision(True)
- def test_override_reset(x: cython.int):
- """
- >>> test_override_reset(-3) if is_compiled else -2 # @cdivision(False)
- -2
- """
- return x / 2
-
- @cython.cdivision(True)
- @cython.cdivision(False)
- def test_override_set(x: cython.int):
- """
- >>> test_override_set(-5) if is_compiled else -1 # @cdivision(True)
- -1
- """
- return x / 3
-
- @cython.cdivision(True)
- @cython.cdivision(False)
- @cython.cdivision(True)
- @cython.cdivision(False)
- @cython.cdivision(False)
- @cython.cdivision(False)
- @cython.cdivision(True)
- @cython.cdivision(False)
- @cython.cdivision(True)
- @cython.cdivision(True)
- @cython.cdivision(True)
- @cython.cdivision(False)
- def test_override_set_repeated(x: cython.int):
- """
- >>> test_override_set_repeated(-5) if is_compiled else -1 # @cdivision(True)
- -1
- """
- return x / 3
-
-
-_WARNINGS = """
-305:0: Directive does not change previous value (nogil=False)
-436:0: Unraisable exception in function 'pure_py.ccall_except_no_check'.
-613:4: Directive does not change previous value (cdivision=True)
-633:4: Directive does not change previous value (cdivision=False)
-634:4: Directive does not change previous value (cdivision=False)
-638:4: Directive does not change previous value (cdivision=True)
-639:4: Directive does not change previous value (cdivision=True)
-
-# BUGS:
-227:0: 'c_call' redeclared
-361:0: 'ccall_except' redeclared
-399:0: 'ccall_except_check' redeclared
-418:0: 'ccall_except_check_always' redeclared
-436:0: 'ccall_except_no_check' redeclared
-"""