summaryrefslogtreecommitdiffstats
path: root/src/sage/structure/sage_object.pyx
diff options
context:
space:
mode:
Diffstat (limited to 'src/sage/structure/sage_object.pyx')
-rw-r--r--src/sage/structure/sage_object.pyx65
1 files changed, 55 insertions, 10 deletions
diff --git a/src/sage/structure/sage_object.pyx b/src/sage/structure/sage_object.pyx
index bb62a4a..b98e3a6 100644
--- a/src/sage/structure/sage_object.pyx
+++ b/src/sage/structure/sage_object.pyx
@@ -2,6 +2,49 @@
# cython: old_style_globals=True
r"""
Abstract base class for Sage objects
+
+TESTS:
+
+Test deprecations::
+
+ sage: from sage.structure.sage_object import (
+ ....: richcmp, richcmp_not_equal,
+ ....: rich_to_bool, py_rich_to_bool, rich_to_bool_sgn,
+ ....: op_EQ, op_NE, op_LT, op_LE, op_GT, op_GE)
+ sage: richcmp(2, 3, op_EQ)
+ doctest:...: DeprecationWarning: Importing richcmp from here is deprecated. If you need to use it, please import it directly from sage.structure.richcmp
+ See http://trac.sagemath.org/23103 for details.
+ doctest:...: DeprecationWarning: Importing op_EQ from here is deprecated. If you need to use it, please import it directly from sage.structure.richcmp
+ See http://trac.sagemath.org/23103 for details.
+ False
+ sage: richcmp_not_equal(2, 3, op_LT)
+ doctest:...: DeprecationWarning: Importing richcmp_not_equal from here is deprecated. If you need to use it, please import it directly from sage.structure.richcmp
+ See http://trac.sagemath.org/23103 for details.
+ doctest:...: DeprecationWarning: Importing op_LT from here is deprecated. If you need to use it, please import it directly from sage.structure.richcmp
+ See http://trac.sagemath.org/23103 for details.
+ True
+ sage: rich_to_bool(op_NE, 0)
+ doctest:...: DeprecationWarning: Importing rich_to_bool from here is deprecated. If you need to use it, please import it directly from sage.structure.richcmp
+ See http://trac.sagemath.org/23103 for details.
+ doctest:...: DeprecationWarning: Importing op_NE from here is deprecated. If you need to use it, please import it directly from sage.structure.richcmp
+ See http://trac.sagemath.org/23103 for details.
+ False
+ sage: py_rich_to_bool(op_GT, 1)
+ doctest:...: DeprecationWarning: Importing rich_to_bool from here is deprecated. If you need to use it, please import it directly from sage.structure.richcmp
+ See http://trac.sagemath.org/21128 for details.
+ doctest:...: DeprecationWarning: Importing op_GT from here is deprecated. If you need to use it, please import it directly from sage.structure.richcmp
+ See http://trac.sagemath.org/23103 for details.
+ True
+ sage: rich_to_bool_sgn(op_LE, -123)
+ doctest:...: DeprecationWarning: Importing rich_to_bool_sgn from here is deprecated. If you need to use it, please import it directly from sage.structure.richcmp
+ See http://trac.sagemath.org/23103 for details.
+ doctest:...: DeprecationWarning: Importing op_LE from here is deprecated. If you need to use it, please import it directly from sage.structure.richcmp
+ See http://trac.sagemath.org/23103 for details.
+ True
+ sage: op_GE
+ doctest:...: DeprecationWarning: Importing op_GE from here is deprecated. If you need to use it, please import it directly from sage.structure.richcmp
+ See http://trac.sagemath.org/23103 for details.
+ 5
"""
from __future__ import absolute_import, print_function
@@ -19,16 +62,18 @@ sys_modules = sys.modules
import zlib; comp = zlib
import bz2; comp_other = bz2
-op_LT = Py_LT # operator <
-op_LE = Py_LE # operator <=
-op_EQ = Py_EQ # operator ==
-op_NE = Py_NE # operator !=
-op_GT = Py_GT # operator >
-op_GE = Py_GE # operator >=
-
-
-from sage.misc.superseded import deprecated_function_alias
-py_rich_to_bool = deprecated_function_alias(21128, rich_to_bool)
+from sage.misc.lazy_import import LazyImport
+richcmp = LazyImport('sage.structure.richcmp', 'richcmp', deprecation=23103)
+richcmp_not_equal = LazyImport('sage.structure.richcmp', 'richcmp_not_equal', deprecation=23103)
+rich_to_bool = LazyImport('sage.structure.richcmp', 'rich_to_bool', deprecation=23103)
+py_rich_to_bool = LazyImport('sage.structure.richcmp', 'rich_to_bool', deprecation=21128)
+rich_to_bool_sgn = LazyImport('sage.structure.richcmp', 'rich_to_bool_sgn', deprecation=23103)
+op_LT = LazyImport('sage.structure.richcmp', 'op_LT', deprecation=23103)
+op_LE = LazyImport('sage.structure.richcmp', 'op_LE', deprecation=23103)
+op_EQ = LazyImport('sage.structure.richcmp', 'op_EQ', deprecation=23103)
+op_NE = LazyImport('sage.structure.richcmp', 'op_NE', deprecation=23103)
+op_GT = LazyImport('sage.structure.richcmp', 'op_GT', deprecation=23103)
+op_GE = LazyImport('sage.structure.richcmp', 'op_GE', deprecation=23103)
cdef process(s):