OverflowError: value too large to perform division
"""
+def _all(seq):
+ for x in seq:
+ if not x:
+ return False
+ return True
+
+try:
+ all
+except NameError:
+ all = _all
+
+
cimport cython
@cython.cdivision(False)
>>> print(sys.exc_info()[0]) # 0
None
>>> exc = test_c()
->>> type(exc) is TestException
+>>> isinstance(exc, TestException) or exc
True
>>> print(sys.exc_info()[0]) # test_c()
None
import sys
if sys.version_info[0] >= 3:
__doc__ = __doc__.replace(u'is unsubscriptable', u'is not subscriptable')
-
+elif sys.version_info < (2,5):
+ __doc__ = __doc__.replace(u"'int' object is unsubscriptable", u'unsubscriptable object')
def index_tuple(tuple t, int i):
return t[i]
>>> os.unlink(statsfile)
"""
+import sys
+if sys.version_info < (2,5):
+ # disable in earlier versions
+ __doc__ = """
+>>> # nothing to test here ...
+"""
+
cimport cython
def test_profile(long N):
"""
# recoding/escaping is required to properly pass the literals to doctest
-).encode('unicode_escape').decode('ASCII')
-
+).encode('unicode_escape').decode('ASCII').replace(u'\\n', u'\n')
a = 'abc'
s = 'aäÄÖöo'
TypeError: 'NoneType' object is not iterable
"""
+import sys
+if sys.version_info < (2,5):
+ __doc__ = __doc__.replace(
+ u"'NoneType' object is not iterable\n >>> tuple_none_list()",
+ u'iteration over non-sequence\n >>> tuple_none_list()')
+
def f(obj1, obj2, obj3, obj4, obj5):
obj1 = ()
return obj1
exit <type 'NoneType'> <type 'NoneType'> <type 'NoneType'>
"""
+import sys
+if sys.version_info < (2,5):
+ __doc__ = __doc__.replace(u"exit <type 'type'> <type 'MyException'>",
+ u"exit <type 'classobj'> <type 'instance'>")
+
def typename(t):
return u"<type '%s'>" % type(t).__name__