From: Stefan Behnel Date: Sat, 7 Jun 2008 13:40:21 +0000 (+0200) Subject: Py3 test fixes X-Git-Tag: 0.9.8rc1~11^2~10^2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b0511036673f2a9048046e90ae076c7e49199b20;p=cython.git Py3 test fixes --- diff --git a/tests/run/big_indices.pyx b/tests/run/big_indices.pyx index 2f368afb..db70fe99 100644 --- a/tests/run/big_indices.pyx +++ b/tests/run/big_indices.pyx @@ -12,10 +12,10 @@ def test(): cdef long neg = -1 cdef unsigned long pos = -2 # will be a large positive number - print "neg", neg > 0 - print "pos", pos > 0 + print u"neg", neg > 0 + print u"pos", pos > 0 - D = { neg: 'neg', pos: 'pos' } + D = { neg: u'neg', pos: u'pos' } print D[neg] print D[pos] diff --git a/tests/run/modop.pyx b/tests/run/modop.pyx index be55648d..48f0c21f 100644 --- a/tests/run/modop.pyx +++ b/tests/run/modop.pyx @@ -6,9 +6,14 @@ __doc__ = u""" >>> modint(9,2) 1 +""" + +import sys +if sys.version_info[0] < 3: + __doc__ = __doc__ + u""" - >>> print modptr() - spameggs + >>> modptr() + 'spameggs' """ def modobj(obj2, obj3): @@ -25,5 +30,5 @@ def modptr(): str2 = "spam%s" str3 = "eggs" - obj1 = str2 % str3 - return obj1.decode(u"ASCII") + obj1 = str2 % str3 # '%' operator doesn't work on byte strings in Py3 + return obj1