Commit cf9b9b59 authored by Stefan Behnel's avatar Stefan Behnel

more test fixes

parent e990db84
...@@ -23,7 +23,7 @@ None ...@@ -23,7 +23,7 @@ None
class A: class A:
def append(self, x): def append(self, x):
print "appending" print u"appending"
return x return x
class B(list): class B(list):
...@@ -38,6 +38,6 @@ def test_append(L): ...@@ -38,6 +38,6 @@ def test_append(L):
try: try:
print L.append(5,6) print L.append(5,6)
except TypeError: except TypeError:
print "got error" print u"got error"
return L return L
...@@ -8,5 +8,5 @@ __doc__ = u""" ...@@ -8,5 +8,5 @@ __doc__ = u"""
class Bicycle: class Bicycle:
def fall_off(self, how_hard = "extremely"): def fall_off(self, how_hard = u"extremely"):
print "Falling off", how_hard, "hard" print u"Falling off", how_hard, u"hard"
...@@ -14,6 +14,6 @@ class CoconutCarrier: ...@@ -14,6 +14,6 @@ class CoconutCarrier:
if name is not None: if name is not None:
print u"This swallow is called", name print u"This swallow is called", name
if airspeed is not None: 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: if coconuts is not None:
print u"This swallow is carrying", coconuts, "coconuts" print u"This swallow is carrying", coconuts, u"coconuts"
__doc__ = u""" __doc__ = u"""
>>> c = C() >>> c = C()
>>> print(c.x) >>> c.x
foo b'foo'
""" """
import sys
if sys.version_info[0] < 3:
__doc__ = __doc__.replace(u" b'", u" '")
class C: class C:
x = "foo" x = "foo"
...@@ -24,7 +24,7 @@ else: ...@@ -24,7 +24,7 @@ else:
__doc__ = __doc__.replace(u" b'", u" '") __doc__ = __doc__.replace(u" b'", u" '")
s = str s = str
z = str('test', **encoding) z = str('test')
def c(string): def c(string):
return str(string, **encoding) return str(string, **encoding)
......
...@@ -21,7 +21,7 @@ if sys.version_info[0] >= 3: ...@@ -21,7 +21,7 @@ if sys.version_info[0] >= 3:
__doc__ = __doc__.replace(u" u'", u" '") __doc__ = __doc__.replace(u" u'", u" '")
u = unicode u = unicode
z = unicode('test') z = unicode(u'test')
def c(string): def c(string):
return unicode(string) return unicode(string)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
__doc__ = r""" __doc__ = r"""
>>> sa >>> sa
'abc' b'abc'
>>> ua >>> ua
u'abc' u'abc'
>>> b >>> b
...@@ -39,8 +39,6 @@ __doc__ = r""" ...@@ -39,8 +39,6 @@ __doc__ = r"""
>>> len(null) >>> len(null)
1 1
""".decode(u"ASCII") + u""" """.decode(u"ASCII") + u"""
>>> sa == 'abc'
True
>>> ua == u'abc' >>> ua == u'abc'
True True
>>> b == u'123' >>> b == u'123'
...@@ -66,6 +64,8 @@ __doc__ = r""" ...@@ -66,6 +64,8 @@ __doc__ = r"""
import sys import sys
if sys.version_info[0] >= 3: if sys.version_info[0] >= 3:
__doc__ = __doc__.replace(u" u'", u" '") __doc__ = __doc__.replace(u" u'", u" '")
else:
__doc__ = __doc__.replace(u" b'", u" '")
sa = 'abc' sa = 'abc'
ua = u'abc' ua = u'abc'
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
__doc__ = r""" __doc__ = r"""
>>> sa >>> sa
'abc' b'abc'
>>> ua >>> ua
u'abc' u'abc'
>>> b >>> b
...@@ -45,8 +45,6 @@ __doc__ = r""" ...@@ -45,8 +45,6 @@ __doc__ = r"""
>>> len(null) >>> len(null)
1 1
""".decode(u"ASCII") + u""" """.decode(u"ASCII") + u"""
>>> sa == 'abc'
True
>>> ua == u'abc' >>> ua == u'abc'
True True
>>> b == u'123' >>> b == u'123'
...@@ -72,6 +70,8 @@ __doc__ = r""" ...@@ -72,6 +70,8 @@ __doc__ = r"""
import sys import sys
if sys.version_info[0] >= 3: if sys.version_info[0] >= 3:
__doc__ = __doc__.replace(u" u'", u" '") __doc__ = __doc__.replace(u" u'", u" '")
else:
__doc__ = __doc__.replace(u" b'", u" '")
sa = 'abc' sa = 'abc'
ua = u'abc' ua = u'abc'
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
__doc__ = r""" __doc__ = r"""
>>> sa >>> sa
'abc' b'abc'
>>> ua >>> ua
u'abc' u'abc'
>>> b >>> b
...@@ -39,8 +39,6 @@ __doc__ = r""" ...@@ -39,8 +39,6 @@ __doc__ = r"""
>>> len(null) >>> len(null)
1 1
""".decode(u"ASCII") + u""" """.decode(u"ASCII") + u"""
>>> sa == 'abc'
True
>>> ua == u'abc' >>> ua == u'abc'
True True
>>> b == u'123' >>> b == u'123'
...@@ -66,6 +64,8 @@ __doc__ = r""" ...@@ -66,6 +64,8 @@ __doc__ = r"""
import sys import sys
if sys.version_info[0] >= 3: if sys.version_info[0] >= 3:
__doc__ = __doc__.replace(u" u'", u" '") __doc__ = __doc__.replace(u" u'", u" '")
else:
__doc__ = __doc__.replace(u" b'", u" '")
sa = 'abc' sa = 'abc'
ua = u'abc' ua = u'abc'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment