summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2022-02-25 21:30:46 +0100
committerStefan Behnel <stefan_ml@behnel.de>2022-02-25 21:30:59 +0100
commita02b0842ccd2d39b753128fc8c7d58b178c58a08 (patch)
tree4f161557dc8fae96193882214be1a325f9d36619 /tests
parenteadc9bd042ba935bb45795c8a9ae3bfba5492efc (diff)
downloadcython-a02b0842ccd2d39b753128fc8c7d58b178c58a08.tar.gz
Also add a deprecation warning for the compile time DEF statement.
See https://github.com/cython/cython/issues/4310
Diffstat (limited to 'tests')
-rw-r--r--tests/run/ct_DEF.pyx29
-rw-r--r--tests/run/ct_IF.pyx7
-rw-r--r--tests/run/public_enum.pyx9
3 files changed, 39 insertions, 6 deletions
diff --git a/tests/run/ct_DEF.pyx b/tests/run/ct_DEF.pyx
index 6998c990c..54f5ff776 100644
--- a/tests/run/ct_DEF.pyx
+++ b/tests/run/ct_DEF.pyx
@@ -1,3 +1,5 @@
+# mode: run
+# tag: warnings
cimport cython
@@ -232,3 +234,30 @@ def none():
>>> none()
"""
return NONE
+
+
+_WARNINGS = """
+24:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
+25:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
+26:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
+28:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
+29:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
+30:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
+31:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
+32:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
+33:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
+34:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
+35:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
+36:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
+37:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
+38:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
+39:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
+40:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
+41:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
+42:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
+43:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
+44:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
+45:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
+46:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
+47:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
+"""
diff --git a/tests/run/ct_IF.pyx b/tests/run/ct_IF.pyx
index 8e8f54e36..03cf68cda 100644
--- a/tests/run/ct_IF.pyx
+++ b/tests/run/ct_IF.pyx
@@ -83,4 +83,11 @@ _WARNINGS = """
41:4: The 'IF' statement is deprecated and will be removed in a future Cython version. Consider using runtime conditions or C macros instead. See https://github.com/cython/cython/issues/4310
56:4: The 'IF' statement is deprecated and will be removed in a future Cython version. Consider using runtime conditions or C macros instead. See https://github.com/cython/cython/issues/4310
71:4: The 'IF' statement is deprecated and will be removed in a future Cython version. Consider using runtime conditions or C macros instead. See https://github.com/cython/cython/issues/4310
+
+4:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
+5:0: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
+57:8: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
+60:8: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
+72:8: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
+75:8: The 'DEF' statement is deprecated and will be removed in a future Cython version. Consider using global variables, constants, and in-place literals instead. See https://github.com/cython/cython/issues/4310
"""
diff --git a/tests/run/public_enum.pyx b/tests/run/public_enum.pyx
index 1697c5d71..15f550b2e 100644
--- a/tests/run/public_enum.pyx
+++ b/tests/run/public_enum.pyx
@@ -1,10 +1,10 @@
-__doc__ = u"""
+# mode: run
+
+"""
>>> BAR == 3
True
>>> HONK == 3+2+1
True
->>> X == 4*5 + 1
-True
>>> NONPUBLIC # doctest: +ELLIPSIS
Traceback (most recent call last):
NameError: ...name 'NONPUBLIC' is not defined
@@ -12,8 +12,6 @@ NameError: ...name 'NONPUBLIC' is not defined
True
"""
-DEF X = 4*5
-
cdef enum SECRET:
NONPUBLIC = 23 + 42
@@ -21,4 +19,3 @@ cdef public enum FOO:
BAR = 3
HONK = 3+2+1
NOWPUBLIC = NONPUBLIC
- X = X + 1 # FIXME: should this really work?