From: Stefan Behnel Date: Fri, 16 May 2008 18:21:02 +0000 (+0200) Subject: more test fixes X-Git-Tag: 0.9.8rc1~11^2~10^2~15^2~43 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=cf9b9b59a3f03bd8863550e5f49a9922d1c1c669;p=cython.git more test fixes --- diff --git a/tests/run/append.pyx b/tests/run/append.pyx index 95ac182a..d8d72ce1 100644 --- a/tests/run/append.pyx +++ b/tests/run/append.pyx @@ -23,7 +23,7 @@ None class A: def append(self, x): - print "appending" + print u"appending" return x class B(list): @@ -38,6 +38,6 @@ def test_append(L): try: print L.append(5,6) except TypeError: - print "got error" + print u"got error" return L diff --git a/tests/run/r_mcintyre1.pyx b/tests/run/r_mcintyre1.pyx index 82d365e8..dd4e0561 100644 --- a/tests/run/r_mcintyre1.pyx +++ b/tests/run/r_mcintyre1.pyx @@ -8,5 +8,5 @@ __doc__ = u""" class Bicycle: - def fall_off(self, how_hard = "extremely"): - print "Falling off", how_hard, "hard" + def fall_off(self, how_hard = u"extremely"): + print u"Falling off", how_hard, u"hard" diff --git a/tests/run/r_pyclassdefault.pyx b/tests/run/r_pyclassdefault.pyx index bc83f49f..bb36727b 100644 --- a/tests/run/r_pyclassdefault.pyx +++ b/tests/run/r_pyclassdefault.pyx @@ -14,6 +14,6 @@ class CoconutCarrier: if name is not None: print u"This swallow is called", name if airspeed is not None: - print u"This swallow is flying at", airspeed, "furlongs per fortnight" + print u"This swallow is flying at", airspeed, u"furlongs per fortnight" if coconuts is not None: - print u"This swallow is carrying", coconuts, "coconuts" + print u"This swallow is carrying", coconuts, u"coconuts" diff --git a/tests/run/strconstinclass.pyx b/tests/run/strconstinclass.pyx index bfde9de0..945acba7 100644 --- a/tests/run/strconstinclass.pyx +++ b/tests/run/strconstinclass.pyx @@ -1,9 +1,13 @@ __doc__ = u""" >>> c = C() - >>> print(c.x) - foo + >>> c.x + b'foo' """ +import sys +if sys.version_info[0] < 3: + __doc__ = __doc__.replace(u" b'", u" '") + class C: x = "foo" diff --git a/tests/run/strfunction.pyx b/tests/run/strfunction.pyx index 3f0ca9d5..9b7964bd 100644 --- a/tests/run/strfunction.pyx +++ b/tests/run/strfunction.pyx @@ -24,7 +24,7 @@ else: __doc__ = __doc__.replace(u" b'", u" '") s = str -z = str('test', **encoding) +z = str('test') def c(string): return str(string, **encoding) diff --git a/tests/run/unicodefunction.pyx b/tests/run/unicodefunction.pyx index 28284791..1d20bef7 100644 --- a/tests/run/unicodefunction.pyx +++ b/tests/run/unicodefunction.pyx @@ -21,7 +21,7 @@ if sys.version_info[0] >= 3: __doc__ = __doc__.replace(u" u'", u" '") u = unicode -z = unicode('test') +z = unicode(u'test') def c(string): return unicode(string) diff --git a/tests/run/unicodeliterals.pyx b/tests/run/unicodeliterals.pyx index 2d08606e..75235709 100644 --- a/tests/run/unicodeliterals.pyx +++ b/tests/run/unicodeliterals.pyx @@ -2,7 +2,7 @@ __doc__ = r""" >>> sa - 'abc' + b'abc' >>> ua u'abc' >>> b @@ -39,8 +39,6 @@ __doc__ = r""" >>> len(null) 1 """.decode(u"ASCII") + u""" - >>> sa == 'abc' - True >>> ua == u'abc' True >>> b == u'123' @@ -66,6 +64,8 @@ __doc__ = r""" import sys if sys.version_info[0] >= 3: __doc__ = __doc__.replace(u" u'", u" '") +else: + __doc__ = __doc__.replace(u" b'", u" '") sa = 'abc' ua = u'abc' diff --git a/tests/run/unicodeliteralsdefault.pyx b/tests/run/unicodeliteralsdefault.pyx index 05129fd3..9f185c19 100644 --- a/tests/run/unicodeliteralsdefault.pyx +++ b/tests/run/unicodeliteralsdefault.pyx @@ -8,7 +8,7 @@ __doc__ = r""" >>> sa - 'abc' + b'abc' >>> ua u'abc' >>> b @@ -45,8 +45,6 @@ __doc__ = r""" >>> len(null) 1 """.decode(u"ASCII") + u""" - >>> sa == 'abc' - True >>> ua == u'abc' True >>> b == u'123' @@ -72,6 +70,8 @@ __doc__ = r""" import sys if sys.version_info[0] >= 3: __doc__ = __doc__.replace(u" u'", u" '") +else: + __doc__ = __doc__.replace(u" b'", u" '") sa = 'abc' ua = u'abc' diff --git a/tests/run/unicodeliteralslatin1.pyx b/tests/run/unicodeliteralslatin1.pyx index ed0817dc..45ac6c16 100644 --- a/tests/run/unicodeliteralslatin1.pyx +++ b/tests/run/unicodeliteralslatin1.pyx @@ -2,7 +2,7 @@ __doc__ = r""" >>> sa - 'abc' + b'abc' >>> ua u'abc' >>> b @@ -39,8 +39,6 @@ __doc__ = r""" >>> len(null) 1 """.decode(u"ASCII") + u""" - >>> sa == 'abc' - True >>> ua == u'abc' True >>> b == u'123' @@ -66,6 +64,8 @@ __doc__ = r""" import sys if sys.version_info[0] >= 3: __doc__ = __doc__.replace(u" u'", u" '") +else: + __doc__ = __doc__.replace(u" b'", u" '") sa = 'abc' ua = u'abc'