running lib2to3.fixes.fix_except

This commit is contained in:
ilvalle
2016-05-29 08:31:19 +02:00
parent 14830e8906
commit 35900da19b
35 changed files with 93 additions and 92 deletions
+9 -9
View File
@@ -175,7 +175,7 @@ class TestIsUrl(unittest.TestCase):
try:
x = IS_URL(mode='ftp')
x('http://www.google.ca')
except Exception, e:
except Exception as e:
if str(e) != "invalid mode 'ftp' in IS_URL":
self.fail('Wrong exception: ' + str(e))
else:
@@ -188,7 +188,7 @@ class TestIsUrl(unittest.TestCase):
prepend_scheme='ftp')
x('http://www.benn.ca') # we can only reasonably know about the
# error at calling time
except Exception, e:
except Exception as e:
if str(e)\
!= "allowed_scheme value 'ftp' is not in [None, 'http', 'https']":
self.fail('Wrong exception: ' + str(e))
@@ -203,7 +203,7 @@ class TestIsUrl(unittest.TestCase):
x = IS_URL(prepend_scheme='ftp')
x('http://www.benn.ca') # we can only reasonably know about the
# error at calling time
except Exception, e:
except Exception as e:
if str(e)\
!= "prepend_scheme='ftp' is not in allowed_schemes=[None, 'http', 'https']":
self.fail('Wrong exception: ' + str(e))
@@ -215,7 +215,7 @@ class TestIsUrl(unittest.TestCase):
try:
x = IS_URL(allowed_schemes=[None, 'https'])
except Exception, e:
except Exception as e:
if str(e)\
!= "prepend_scheme='http' is not in allowed_schemes=[None, 'https']":
self.fail('Wrong exception: ' + str(e))
@@ -227,7 +227,7 @@ class TestIsUrl(unittest.TestCase):
try:
x = IS_URL(allowed_schemes=[None, 'http'],
prepend_scheme='https')
except Exception, e:
except Exception as e:
if str(e)\
!= "prepend_scheme='https' is not in allowed_schemes=[None, 'http']":
self.fail('Wrong exception: ' + str(e))
@@ -239,7 +239,7 @@ class TestIsUrl(unittest.TestCase):
try:
x = IS_URL(mode='generic', allowed_schemes=[None, 'ftp',
'ftps'])
except Exception, e:
except Exception as e:
if str(e)\
!= "prepend_scheme='http' is not in allowed_schemes=[None, 'ftp', 'ftps']":
self.fail('Wrong exception: ' + str(e))
@@ -253,7 +253,7 @@ class TestIsUrl(unittest.TestCase):
x = IS_URL(mode='generic', prepend_scheme='blargg')
x('http://www.google.ca')
# we can only reasonably know about the error at calling time
except Exception, e:
except Exception as e:
if not str(e).startswith(
"prepend_scheme='blargg' is not in allowed_schemes="):
self.fail('Wrong exception: ' + str(e))
@@ -265,7 +265,7 @@ class TestIsUrl(unittest.TestCase):
try:
x = IS_URL(mode='generic', allowed_schemes=[None, 'http'],
prepend_scheme='blargg')
except Exception, e:
except Exception as e:
if str(e)\
!= "prepend_scheme='blargg' is not in allowed_schemes=[None, 'http']":
self.fail('Wrong exception: ' + str(e))
@@ -567,7 +567,7 @@ class TestIsHttpUrl(unittest.TestCase):
try:
IS_HTTP_URL(prepend_scheme='mailto')
except Exception, e:
except Exception as e:
if str(e)\
!= "prepend_scheme='mailto' is not in allowed_schemes=[None, 'http', 'https']":
self.fail('Wrong exception: ' + str(e))
+2 -2
View File
@@ -121,7 +121,7 @@ class TestWeb(LiveTest):
try:
ret = client.Division(a=3, b=0)
except SoapFault, sf:
except SoapFault as sf:
# verify the exception value is ok
# assert(sf.faultstring == "float division by zero") # true only in 2.7
assert(sf.faultcode == "Server.ZeroDivisionError")
@@ -134,7 +134,7 @@ class TestWeb(LiveTest):
s = WebClient('http://127.0.0.1:8000/')
try:
s.post('examples/soap_examples/call/soap', data=xml_request, method="POST")
except HTTPError, e:
except HTTPError as e:
assert(e.msg == 'INTERNAL SERVER ERROR')
# check internal server error returned (issue 153)
assert(s.status == 500)