Commit 93551a15 authored by Stefan Behnel's avatar Stefan Behnel

Py3 test fixes

parent 80c100a5
...@@ -23,9 +23,9 @@ __doc__ = u""" ...@@ -23,9 +23,9 @@ __doc__ = u"""
""" """
def test_in(s): def test_in(s):
if s in ('ABC', 'BCD'): if s in (u'ABC', u'BCD'):
return 1 return 1
elif s.upper() in ('ABC', 'BCD'): elif s.upper() in (u'ABC', u'BCD'):
return 2 return 2
elif len(s) in (1,2): elif len(s) in (1,2):
return 3 return 3
...@@ -35,9 +35,9 @@ def test_in(s): ...@@ -35,9 +35,9 @@ def test_in(s):
return 5 return 5
def test_not_in(s): def test_not_in(s):
if s not in ('ABC', 'BCD', 'CDE', 'CDEF'): if s not in (u'ABC', u'BCD', u'CDE', u'CDEF'):
return 1 return 1
elif s.upper() not in ('ABC', 'BCD', 'CDEF'): elif s.upper() not in (u'ABC', u'BCD', u'CDEF'):
return 2 return 2
elif len(s) not in [3]: elif len(s) not in [3]:
return 3 return 3
......
...@@ -49,20 +49,20 @@ class ContextManager: ...@@ -49,20 +49,20 @@ class ContextManager:
return self.value return self.value
def no_as(): def no_as():
with ContextManager("value"): with ContextManager(u"value"):
print "hello" print u"hello"
def basic(): def basic():
with ContextManager("value") as x: with ContextManager(u"value") as x:
print x print x
def with_exception(exit_ret): def with_exception(exit_ret):
try: try:
with ContextManager("value", exit_ret=exit_ret) as value: with ContextManager(u"value", exit_ret=exit_ret) as value:
print value print value
raise MyException() raise MyException()
except: except:
print "outer except" print u"outer except"
def multitarget(): def multitarget():
with ContextManager((1, 2, (3, (4, 5)))) as (a, b, (c, (d, e))): with ContextManager((1, 2, (3, (4, 5)))) as (a, b, (c, (d, e))):
......
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