From: Stefan Behnel Date: Fri, 21 Aug 2009 09:47:37 +0000 (+0200) Subject: Py3 test fixes X-Git-Tag: 0.12.alpha0~237 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7db195ac46ac8761f9813c861fbc0e003d24289a;p=cython.git Py3 test fixes --- diff --git a/tests/run/importfrom.pyx b/tests/run/importfrom.pyx index 5135922b..19bc40d1 100644 --- a/tests/run/importfrom.pyx +++ b/tests/run/importfrom.pyx @@ -12,7 +12,7 @@ True True True an integer is required -Expected tuple, got int +Expected type, got int """ def import1(): @@ -48,14 +48,15 @@ def import4(): def typed_imports(): import sys + import types cdef long maxunicode - cdef tuple t + cdef type t from sys import maxunicode print maxunicode == sys.maxunicode - from sys import version_info as t - print t is sys.version_info - + from types import ModuleType as t + print t is types.ModuleType + try: from sys import version_info as maxunicode except TypeError, e: diff --git a/tests/run/index.pyx b/tests/run/index.pyx index 223e687a..305505ca 100644 --- a/tests/run/index.pyx +++ b/tests/run/index.pyx @@ -48,6 +48,10 @@ TypeError: 'int' object is unsubscriptable >>> test_long_long() """ +import sys +if sys.version_info[0] >= 3: + __doc__ = __doc__.replace(u'is unsubscriptable', u'is not subscriptable') + def index_tuple(tuple t, int i): return t[i] diff --git a/tests/run/typedfieldbug_T303.pyx b/tests/run/typedfieldbug_T303.pyx index 14410bd7..4b19ef1f 100644 --- a/tests/run/typedfieldbug_T303.pyx +++ b/tests/run/typedfieldbug_T303.pyx @@ -1,4 +1,4 @@ -""" +__doc__ = u""" >>> f() 42.0 42.0 @@ -12,9 +12,13 @@ TypeError: readonly attribute Traceback (most recent call last): ... SystemError: bad memberdescr type - """ +import sys +if sys.version_info[0] >= 3: + __doc__ = __doc__.replace(u'TypeError:', u'AttributeError:') + + cdef extern from "external_defs.h": ctypedef float DoubleTypedef ctypedef float LongDoubleTypedef