autopep8 cleanup of Examples/test-suite/python

automated cleanup of python pep8 whitespace compliance
This commit is contained in:
Jon Schlueter 2015-05-06 08:27:35 -04:00 committed by Jon Schlueter
commit b77f3afafb
202 changed files with 3477 additions and 3382 deletions

View file

@ -1,21 +1,29 @@
from director_exception import *
class MyException(Exception):
def __init__(self, a, b):
self.msg = a + b
def __init__(self, a, b):
self.msg = a + b
class MyFoo(Foo):
def ping(self):
raise NotImplementedError, "MyFoo::ping() EXCEPTION"
def ping(self):
raise NotImplementedError, "MyFoo::ping() EXCEPTION"
class MyFoo2(Foo):
def ping(self):
return True
pass # error: should return a string
def ping(self):
return True
pass # error: should return a string
class MyFoo3(Foo):
def ping(self):
raise MyException("foo", "bar")
def ping(self):
raise MyException("foo", "bar")
# Check that the NotImplementedError raised by MyFoo.ping() is returned by
# MyFoo.pong().
@ -23,16 +31,16 @@ ok = 0
a = MyFoo()
b = launder(a)
try:
b.pong()
b.pong()
except NotImplementedError, e:
if str(e) == "MyFoo::ping() EXCEPTION":
ok = 1
else:
print "Unexpected error message: %s" % str(e)
if str(e) == "MyFoo::ping() EXCEPTION":
ok = 1
else:
print "Unexpected error message: %s" % str(e)
except:
pass
pass
if not ok:
raise RuntimeError
raise RuntimeError
# Check that the director returns the appropriate TypeError if the return type
@ -41,14 +49,14 @@ ok = 0
a = MyFoo2()
b = launder(a)
try:
b.pong()
b.pong()
except TypeError, e:
if str(e) == "SWIG director type mismatch in output value of type 'std::string'":
ok = 1
else:
print "Unexpected error message: %s" % str(e)
if str(e) == "SWIG director type mismatch in output value of type 'std::string'":
ok = 1
else:
print "Unexpected error message: %s" % str(e)
if not ok:
raise RuntimeError
raise RuntimeError
# Check that the director can return an exception which requires two arguments
@ -57,24 +65,24 @@ ok = 0
a = MyFoo3()
b = launder(a)
try:
b.pong()
b.pong()
except MyException, e:
if e.msg == 'foobar':
ok = 1
else:
print "Unexpected error message: %s" % str(e)
if e.msg == 'foobar':
ok = 1
else:
print "Unexpected error message: %s" % str(e)
if not ok:
raise RuntimeError
raise RuntimeError
# This is expected to fail with -builtin option
# Throwing builtin classes as exceptions not supported
if not is_python_builtin():
try:
raise Exception2()
except Exception2:
pass
try:
raise Exception2()
except Exception2:
pass
try:
raise Exception1()
except Exception1:
pass
try:
raise Exception1()
except Exception1:
pass