Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagelib
Path: blob/master/sage/tests/cython.pyx
4057 views
1
"""
2
This file collects tests requiring Cython.
3
"""
4
#*****************************************************************************
5
# Copyright (C) 2012 Jeroen Demeyer <[email protected]>
6
# Copyright (C) 2012 Simon King <[email protected]>
7
#
8
# Distributed under the terms of the GNU General Public License (GPL)
9
# as published by the Free Software Foundation; either version 2 of
10
# the License, or (at your option) any later version.
11
# http://www.gnu.org/licenses/
12
#*****************************************************************************
13
14
from sage.categories.category_singleton cimport FastHashable_class
15
cdef class ClassWithLargeHash(FastHashable_class):
16
"""
17
This class tests against a bug with :class:`FastHashable_class`
18
(in an earlier version of the patch at Trac #11900) that occurred
19
on systems where ``sys.maxint`` does not fit into a C int.
20
21
TESTS::
22
23
sage: import sage.tests.cython
24
sage: C = sage.tests.cython.ClassWithLargeHash(); C
25
A successfully created object with a very large hash
26
sage: hash(C) == sys.maxint
27
True
28
"""
29
def __init__(self):
30
import sys
31
self._hash = sys.maxint
32
def __repr__(self):
33
return 'A successfully created object with a very large hash'
34
35