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,11 +1,13 @@
from implicittest import *
def check(a, b):
if a != b:
raise RuntimeError(str(a) + " does not equal " + str(b))
def is_new_style_class(cls):
return hasattr(cls, "__class__")
return hasattr(cls, "__class__")
#### Class ####
@ -20,7 +22,8 @@ try:
except ValueError:
# ValueError: invalid null reference in method 'new_A', argument 1 of type 'B const &'
# Arguably A(char *) should be chosen, but there is a bug to do with None passed to methods overloaded by value,
# references and pointers to different types, where pointers ought to be given a slightly higher precedence.
# references and pointers to different types, where pointers ought to be
# given a slightly higher precedence.
pass
check(1, get(1))
@ -43,9 +46,9 @@ check(3, A_int(B()).get())
check(4, A_int("hello").get())
if is_new_style_class(A_int):
A_int_static = A_int
A_int_static = A_int
else:
A_int_static = A_int(0)
A_int_static = A_int(0)
check(1, A_int_static.sget(1))
check(2, A_int_static.sget(1.0))
check(3, A_int_static.sget(B()))
@ -59,10 +62,14 @@ except TypeError:
#### Global variable assignment ####
cvar.foo = Foo(1); check(cvar.foo.ii, 1)
cvar.foo = 1; check(cvar.foo.ii, 1)
cvar.foo = 1.0; check(cvar.foo.ii, 2)
cvar.foo = Foo("hello"); check(cvar.foo.ii, 3)
cvar.foo = Foo(1)
check(cvar.foo.ii, 1)
cvar.foo = 1
check(cvar.foo.ii, 1)
cvar.foo = 1.0
check(cvar.foo.ii, 2)
cvar.foo = Foo("hello")
check(cvar.foo.ii, 3)
# explicit constructor:
try:
@ -74,10 +81,14 @@ except TypeError:
#### Member variable assignment ####
# Note: also needs naturalvar
b = Bar(); check(b.f.ii, 0)
b.f = Foo("hello"); check(b.f.ii, 3)
b.f = 1; check(b.f.ii, 1)
b.f = 1.0; check(b.f.ii, 2)
b = Bar()
check(b.f.ii, 0)
b.f = Foo("hello")
check(b.f.ii, 3)
b.f = 1
check(b.f.ii, 1)
b.f = 1.0
check(b.f.ii, 2)
# explicit constructor:
try:
@ -129,4 +140,3 @@ ccc = CCC(B())
check(ccc.checkvalue, 10)
check(ccc.xx(123), 11)
check(ccc.yy(123, 123), 111)