class A:
def append(self, x):
- print "appending"
+ print u"appending"
return x
class B(list):
try:
print L.append(5,6)
except TypeError:
- print "got error"
+ print u"got error"
return L
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"
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"
__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"
__doc__ = __doc__.replace(u" b'", u" '")
s = str
-z = str('test', **encoding)
+z = str('test')
def c(string):
return str(string, **encoding)
__doc__ = __doc__.replace(u" u'", u" '")
u = unicode
-z = unicode('test')
+z = unicode(u'test')
def c(string):
return unicode(string)
__doc__ = r"""
>>> sa
- 'abc'
+ b'abc'
>>> ua
u'abc'
>>> b
>>> len(null)
1
""".decode(u"ASCII") + u"""
- >>> sa == 'abc'
- True
>>> ua == u'abc'
True
>>> b == u'123'
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'
__doc__ = r"""
>>> sa
- 'abc'
+ b'abc'
>>> ua
u'abc'
>>> b
>>> len(null)
1
""".decode(u"ASCII") + u"""
- >>> sa == 'abc'
- True
>>> ua == u'abc'
True
>>> b == u'123'
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'
__doc__ = r"""
>>> sa
- 'abc'
+ b'abc'
>>> ua
u'abc'
>>> b
>>> len(null)
1
""".decode(u"ASCII") + u"""
- >>> sa == 'abc'
- True
>>> ua == u'abc'
True
>>> b == u'123'
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'