diff options
author | Dmitry D. Chernov <blackdoomer@yandex.ru> | 2019-07-14 12:58:21 +1000 |
---|---|---|
committer | Dmitry D. Chernov <blackdoomer@yandex.ru> | 2019-07-14 12:58:21 +1000 |
commit | fa5f519bf9842b523a12cab0bc20f836d8a8a903 (patch) | |
tree | 19356226c42d3ece93024fa4a80597ee25bc531e /Examples | |
parent | c4ad3480bdae23239d7feeaa10e8755133ff20b4 (diff) | |
download | swig-fa5f519bf9842b523a12cab0bc20f836d8a8a903.tar.gz |
Test-suite: Unify string quoting in the Python sources
Diffstat (limited to 'Examples')
23 files changed, 146 insertions, 146 deletions
diff --git a/Examples/test-suite/python/argcargvtest_runme.py b/Examples/test-suite/python/argcargvtest_runme.py index 38843b932..b0345746f 100644 --- a/Examples/test-suite/python/argcargvtest_runme.py +++ b/Examples/test-suite/python/argcargvtest_runme.py @@ -1,21 +1,21 @@ from argcargvtest import * -largs = ['hi', 'hola', 'hello'] +largs = ["hi", "hola", "hello"] if mainc(largs) != 3: raise RuntimeError("bad main typemap") -targs = ('hi', 'hola') -if mainv(targs, 1) != 'hola': +targs = ("hi", "hola") +if mainv(targs, 1) != "hola": print(mainv(targs, 1)) raise RuntimeError("bad main typemap") -targs = ('hi', 'hola') -if mainv(targs, 1) != 'hola': +targs = ("hi", "hola") +if mainv(targs, 1) != "hola": raise RuntimeError("bad main typemap") try: error = 0 - mainv('hello', 1) + mainv("hello", 1) error = 1 except TypeError: pass diff --git a/Examples/test-suite/python/char_binary_runme.py b/Examples/test-suite/python/char_binary_runme.py index 34caa3208..0425fe1c9 100644 --- a/Examples/test-suite/python/char_binary_runme.py +++ b/Examples/test-suite/python/char_binary_runme.py @@ -1,26 +1,26 @@ from char_binary import * t = Test() -if t.strlen('hile') != 4: - print t.strlen('hile') +if t.strlen("hile") != 4: + print t.strlen("hile") raise RuntimeError, "bad multi-arg typemap" -if t.ustrlen('hile') != 4: - print t.ustrlen('hile') +if t.ustrlen("hile") != 4: + print t.ustrlen("hile") raise RuntimeError, "bad multi-arg typemap" -if t.strlen('hil\0') != 4: +if t.strlen("hil\0") != 4: raise RuntimeError, "bad multi-arg typemap" -if t.ustrlen('hil\0') != 4: +if t.ustrlen("hil\0") != 4: raise RuntimeError, "bad multi-arg typemap" # # creating a raw char* # pc = new_pchar(5) -pchar_setitem(pc, 0, 'h') -pchar_setitem(pc, 1, 'o') -pchar_setitem(pc, 2, 'l') -pchar_setitem(pc, 3, 'a') +pchar_setitem(pc, 0, "h") +pchar_setitem(pc, 1, "o") +pchar_setitem(pc, 2, "l") +pchar_setitem(pc, 3, "a") pchar_setitem(pc, 4, 0) diff --git a/Examples/test-suite/python/comment_verifier.py b/Examples/test-suite/python/comment_verifier.py index 57ac0b721..653cb4940 100644 --- a/Examples/test-suite/python/comment_verifier.py +++ b/Examples/test-suite/python/comment_verifier.py @@ -1,10 +1,10 @@ def check(got, expected, expected_builtin=None): if got is None: # Absence of comment is equivalent to empty comment. - got = '' + got = "" if got != expected: import re - p = re.compile(r'^[+-]([^+-].*\S)?(\s+)$', re.M) + p = re.compile(r"^[+-]([^+-].*\S)?(\s+)$", re.M) def make_trailing_spaces_visible(str): def replace_trailing_spaces(match): diff --git a/Examples/test-suite/python/cpp17_u8_char_literals_runme.py b/Examples/test-suite/python/cpp17_u8_char_literals_runme.py index 81f34f193..e2f8897f3 100644 --- a/Examples/test-suite/python/cpp17_u8_char_literals_runme.py +++ b/Examples/test-suite/python/cpp17_u8_char_literals_runme.py @@ -1,10 +1,10 @@ from cpp17_u8_char_literals import * -if cvar.a != 'a': +if cvar.a != "a": raise RuntimeError -if cvar.u != 'u': +if cvar.u != "u": raise RuntimeError -if cvar.u8 != '8': +if cvar.u8 != "8": raise RuntimeError diff --git a/Examples/test-suite/python/default_args_runme.py b/Examples/test-suite/python/default_args_runme.py index 683314dfe..14ef8c594 100644 --- a/Examples/test-suite/python/default_args_runme.py +++ b/Examples/test-suite/python/default_args_runme.py @@ -170,23 +170,23 @@ def run(module_name): if default_args.CDA().cdefaultargs_test2() != 1: raise RuntimeError - if default_args.chartest1() != 'x': + if default_args.chartest1() != "x": raise RuntimeError - if default_args.chartest2() != '\0': + if default_args.chartest2() != "\0": raise RuntimeError - if default_args.chartest3() != '\1': + if default_args.chartest3() != "\1": raise RuntimeError - if default_args.chartest4() != '\n': + if default_args.chartest4() != "\n": raise RuntimeError - if default_args.chartest5() != 'B': + if default_args.chartest5() != "B": raise RuntimeError - if default_args.chartest6() != 'C': + if default_args.chartest6() != "C": raise RuntimeError if __name__ == "__main__": - run('default_args') + run("default_args") diff --git a/Examples/test-suite/python/director_exception_runme.py b/Examples/test-suite/python/director_exception_runme.py index aa9d490a3..06856f30a 100644 --- a/Examples/test-suite/python/director_exception_runme.py +++ b/Examples/test-suite/python/director_exception_runme.py @@ -75,7 +75,7 @@ b = launder(a) try: b.pong() except MyException, e: - if e.msg == 'foobar': + if e.msg == "foobar": ok = 1 else: print "Unexpected error message: %s" % str(e) diff --git a/Examples/test-suite/python/doxygen_misc_constructs_runme.py b/Examples/test-suite/python/doxygen_misc_constructs_runme.py index c441c3dfe..11aa53ba3 100644 --- a/Examples/test-suite/python/doxygen_misc_constructs_runme.py +++ b/Examples/test-suite/python/doxygen_misc_constructs_runme.py @@ -44,7 +44,7 @@ comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.getConnection), comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.getFirstLetter), - r'' + r"" ) comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.ClassWithNestedEnum), @@ -73,7 +73,7 @@ comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.isNoSpaceValidB), ) comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.isNoSpaceValidC), - r'' + r"" ) comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.backslashA), diff --git a/Examples/test-suite/python/ignore_parameter_runme.py b/Examples/test-suite/python/ignore_parameter_runme.py index 5f1342e4a..2b5c21235 100644 --- a/Examples/test-suite/python/ignore_parameter_runme.py +++ b/Examples/test-suite/python/ignore_parameter_runme.py @@ -2,7 +2,7 @@ from ignore_parameter import * def check(a, b): if a != b: - raise RuntimeError('"%s" != "%s"' % (a, b)) + raise RuntimeError("'%s' != '%s'" % (a, b)) check(jaguar(200, 0), "hello") check(lotus("foo", 1), 101) diff --git a/Examples/test-suite/python/li_cstring_runme.py b/Examples/test-suite/python/li_cstring_runme.py index 6fec5362b..b718f1352 100644 --- a/Examples/test-suite/python/li_cstring_runme.py +++ b/Examples/test-suite/python/li_cstring_runme.py @@ -18,10 +18,10 @@ if test4("hello") != "hello-suffix": print test4("hello") raise RuntimeError -if test5(4) != 'xxxx': +if test5(4) != "xxxx": raise RuntimeError -if test6(10) != 'xxxxx': +if test6(10) != "xxxxx": raise RuntimeError if test7() != "Hello world!": diff --git a/Examples/test-suite/python/li_cwstring_runme.py b/Examples/test-suite/python/li_cwstring_runme.py index b2b23a862..5dd7b9b20 100644 --- a/Examples/test-suite/python/li_cwstring_runme.py +++ b/Examples/test-suite/python/li_cwstring_runme.py @@ -15,10 +15,10 @@ if test3("hello") != u"hello-suffix": if test4("hello") != u"hello-suffix": raise RuntimeError -if test5(4) != u'xxxx': +if test5(4) != u"xxxx": raise RuntimeError -if test6(10) != u'xxxxx': +if test6(10) != u"xxxxx": raise RuntimeError if test7() != u"Hello world!": diff --git a/Examples/test-suite/python/li_std_set_runme.py b/Examples/test-suite/python/li_std_set_runme.py index f6fad5561..5e5b72442 100644 --- a/Examples/test-suite/python/li_std_set_runme.py +++ b/Examples/test-suite/python/li_std_set_runme.py @@ -90,5 +90,5 @@ sum = () for i in s: sum = sum + (i,) -if (len(sum) != 3 or (not 1 in sum) or (not 'hello' in sum) or (not (1, 2) in sum)): +if (len(sum) != 3 or (not 1 in sum) or (not "hello" in sum) or (not (1, 2) in sum)): raise RuntimeError diff --git a/Examples/test-suite/python/li_std_string_extra_runme.py b/Examples/test-suite/python/li_std_string_extra_runme.py index 53d2bdc75..087d92b19 100644 --- a/Examples/test-suite/python/li_std_string_extra_runme.py +++ b/Examples/test-suite/python/li_std_string_extra_runme.py @@ -19,7 +19,7 @@ if li_std_string_extra.test_const_reference(x) != x: s = li_std_string_extra.string("he") #s += "ll" -# s.append('o') +# s.append("o") s = s + "llo" if s != x: diff --git a/Examples/test-suite/python/li_std_vector_extra_runme.py b/Examples/test-suite/python/li_std_vector_extra_runme.py index 88105ea85..59e729a27 100644 --- a/Examples/test-suite/python/li_std_vector_extra_runme.py +++ b/Examples/test-suite/python/li_std_vector_extra_runme.py @@ -91,7 +91,7 @@ if v.size() != 0: v = vecStr(["hello ", "world"]) -if v[0] != 'hello world': +if v[0] != "hello world": raise RuntimeError, "bad std::string+std::vector" diff --git a/Examples/test-suite/python/primitive_ref_runme.py b/Examples/test-suite/python/primitive_ref_runme.py index f3a640389..2f1a5144c 100644 --- a/Examples/test-suite/python/primitive_ref_runme.py +++ b/Examples/test-suite/python/primitive_ref_runme.py @@ -33,7 +33,7 @@ if ref_double(3.5) != 3.5: if ref_bool(True) != True: raise RuntimeError -if ref_char('x') != 'x': +if ref_char("x") != "x": raise RuntimeError if ref_over(0) != 0: diff --git a/Examples/test-suite/python/primitive_types_runme.py b/Examples/test-suite/python/primitive_types_runme.py index c5009f640..04588ddf2 100644 --- a/Examples/test-suite/python/primitive_types_runme.py +++ b/Examples/test-suite/python/primitive_types_runme.py @@ -227,7 +227,7 @@ t.var_paramc = sct_paramc t.v_check() # this value contains a '0' char! -if def_namet != 'hola': +if def_namet != "hola": print "bad namet", def_namet raise RuntimeError @@ -236,54 +236,54 @@ if t.var_namet != def_namet: print "bad namet", t.var_namet, def_namet raise RuntimeError -t.var_namet = 'hola' +t.var_namet = "hola" -if t.var_namet != 'hola': +if t.var_namet != "hola": print "bad namet", t.var_namet raise RuntimeError -t.var_namet = 'hol' +t.var_namet = "hol" -if t.var_namet != 'hol': - # if t.var_namet != 'hol\0\0': +if t.var_namet != "hol": + # if t.var_namet != "hol\0\0": print "bad namet", t.var_namet raise RuntimeError -cvar.var_char = '\0' -if cvar.var_char != '\0': +cvar.var_char = "\0" +if cvar.var_char != "\0": raise RuntimeError, "bad char '0' case" cvar.var_char = 0 -if cvar.var_char != '\0': +if cvar.var_char != "\0": raise RuntimeError, "bad char '0' case" -cvar.var_namet = '\0' -# if cvar.var_namet != '\0\0\0\0\0': -if cvar.var_namet != '': - print 'hola', '', cvar.var_namet +cvar.var_namet = "\0" +# if cvar.var_namet != "\0\0\0\0\0": +if cvar.var_namet != "": + print "hola", "", cvar.var_namet raise RuntimeError, "bad char '\0' case" -cvar.var_namet = '' -# if cvar.var_namet != '\0\0\0\0\0': -if cvar.var_namet != '': +cvar.var_namet = "" +# if cvar.var_namet != "\0\0\0\0\0": +if cvar.var_namet != "": raise RuntimeError, "bad char empty case" cvar.var_pchar = None if cvar.var_pchar != None: raise RuntimeError, "bad None case" -cvar.var_pchar = '' -if cvar.var_pchar != '': - print '%c' % (cvar.var_pchar[0],) +cvar.var_pchar = "" +if cvar.var_pchar != "": + print "%c" % (cvar.var_pchar[0],) raise RuntimeError, "bad char empty case" cvar.var_pcharc = None if cvar.var_pcharc != None: raise RuntimeError, "bad None case" -cvar.var_pcharc = '' -if cvar.var_pcharc != '': +cvar.var_pcharc = "" +if cvar.var_pcharc != "": raise RuntimeError, "bad char empty case" @@ -291,10 +291,10 @@ if cvar.var_pcharc != '': # creating a raw char* # pc = new_pchar(5) -pchar_setitem(pc, 0, 'h') -pchar_setitem(pc, 1, 'o') -pchar_setitem(pc, 2, 'l') -pchar_setitem(pc, 3, 'a') +pchar_setitem(pc, 0, "h") +pchar_setitem(pc, 1, "o") +pchar_setitem(pc, 2, "l") +pchar_setitem(pc, 3, "a") pchar_setitem(pc, 4, 0) @@ -331,7 +331,7 @@ if error: try: error = 0 a = t.var_char - t.var_char = '23' + t.var_char = "23" error = 1 except TypeError: if a != t.var_char: @@ -393,7 +393,7 @@ if error: try: error = 0 a = t.var_namet - t.var_namet = '123456' + t.var_namet = "123456" error = 1 except TypeError: if a != t.var_namet: @@ -410,11 +410,11 @@ if t.var_namet != t2.var_namet: raise RuntimeError, "bad SWIGTYPE* typemap" -if cvar.fixsize != 'ho\0la\0\0\0': +if cvar.fixsize != "ho\0la\0\0\0": raise RuntimeError, "bad FIXSIZE typemap" -cvar.fixsize = 'ho' -if cvar.fixsize != 'ho\0\0\0\0\0\0': +cvar.fixsize = "ho" +if cvar.fixsize != "ho\0\0\0\0\0\0": raise RuntimeError, "bad FIXSIZE typemap" @@ -487,26 +487,26 @@ def checkType(t, e, val, delta): """t = Test object, e = type name (e.g. ulong), val = max or min allowed value, delta = +1 for max, -1 for min""" error = 0 # Set the extreme valid value for var_* - setattr(t, 'var_' + e, val) + setattr(t, "var_" + e, val) # Make sure it was set properly and works properly in the val_* and ref_* methods - if getattr(t, 'var_' + e) != val or getattr(t, 'val_' + e)(val) != val or getattr(t, 'ref_' + e)(val) != val: + if getattr(t, "var_" + e) != val or getattr(t, "val_" + e)(val) != val or getattr(t, "ref_" + e)(val) != val: error = 1 # Make sure setting a more extreme value fails without changing the value try: - a = getattr(t, 'var_' + e) - setattr(t, 'var_' + e, val + delta) + a = getattr(t, "var_" + e) + setattr(t, "var_" + e, val + delta) error = 1 except OverflowError: - if a != getattr(t, 'var_' + e): + if a != getattr(t, "var_" + e): error = 1 # Make sure the val_* and ref_* methods fail with a more extreme value try: - getattr(t, 'val_' + e)(val + delta) + getattr(t, "val_" + e)(val + delta) error = 1 except OverflowError: pass try: - getattr(t, 'ref_' + e)(val + delta) + getattr(t, "ref_" + e)(val + delta) error = 1 except OverflowError: pass @@ -518,16 +518,16 @@ def checkFull(t, e, maxval, minval): checkType(t, e, maxval, 1) checkType(t, e, minval, -1) -checkFull(t, 'llong', maxllong, minllong) -checkFull(t, 'long', maxlong, minlong) -checkFull(t, 'int', maxint, minint) -checkFull(t, 'short', maxshort, minshort) -checkFull(t, 'schar', maxchar, minchar) -checkFull(t, 'ullong', maxullong, 0) -checkFull(t, 'ulong', maxulong, 0) -checkFull(t, 'uint', maxuint, 0) -checkFull(t, 'ushort', maxushort, 0) -checkFull(t, 'uchar', maxuchar, 0) +checkFull(t, "llong", maxllong, minllong) +checkFull(t, "long", maxlong, minlong) +checkFull(t, "int", maxint, minint) +checkFull(t, "short", maxshort, minshort) +checkFull(t, "schar", maxchar, minchar) +checkFull(t, "ullong", maxullong, 0) +checkFull(t, "ulong", maxulong, 0) +checkFull(t, "uint", maxuint, 0) +checkFull(t, "ushort", maxushort, 0) +checkFull(t, "uchar", maxuchar, 0) def checkOverload(t, name, val, delta, prevval, limit): """ @@ -556,16 +556,16 @@ def checkOverload(t, name, val, delta, prevval, limit): raise RuntimeError, "bad " + name + " typemap" # Check that overloading works: uchar > schar > ushort > short > uint > int > ulong > long > ullong > llong -checkOverload(t, 'uchar', maxuchar, +1, 0, maxullong) -checkOverload(t, 'ushort', maxushort, +1, maxuchar, maxullong) -checkOverload(t, 'uint', maxuint, +1, maxushort, maxullong) -checkOverload(t, 'ulong', maxulong, +1, maxuint, maxullong) -checkOverload(t, 'ullong', maxullong, +1, maxulong, maxullong) -checkOverload(t, 'schar', minchar, -1, 0, minllong) -checkOverload(t, 'short', minshort, -1, minchar, minllong) -checkOverload(t, 'int', minint, -1, minshort, minllong) -checkOverload(t, 'long', minlong, -1, minint, minllong) -checkOverload(t, 'llong', minllong, -1, minlong, minllong) +checkOverload(t, "uchar", maxuchar, +1, 0, maxullong) +checkOverload(t, "ushort", maxushort, +1, maxuchar, maxullong) +checkOverload(t, "uint", maxuint, +1, maxushort, maxullong) +checkOverload(t, "ulong", maxulong, +1, maxuint, maxullong) +checkOverload(t, "ullong", maxullong, +1, maxulong, maxullong) +checkOverload(t, "schar", minchar, -1, 0, minllong) +checkOverload(t, "short", minshort, -1, minchar, minllong) +checkOverload(t, "int", minint, -1, minshort, minllong) +checkOverload(t, "long", minlong, -1, minint, minllong) +checkOverload(t, "llong", minllong, -1, minlong, minllong) # Make sure that large ints can be converted to doubles properly if val_double(sys.maxint + 1) != float(sys.maxint + 1): diff --git a/Examples/test-suite/python/python_pybuffer_runme.py b/Examples/test-suite/python/python_pybuffer_runme.py index 85cfb75d3..8ecdb523b 100644 --- a/Examples/test-suite/python/python_pybuffer_runme.py +++ b/Examples/test-suite/python/python_pybuffer_runme.py @@ -14,13 +14,13 @@ if len(sys.argv) >= 2 and sys.argv[1] == "benchmark": k = 1000000 # number of times to execute the functions t = time.time() - a = bytearray(b'hello world') + a = bytearray(b"hello world") for i in range(k): python_pybuffer.title1(a) print "Time used by bytearray:", time.time() - t t = time.time() - b = 'hello world' + b = "hello world" for i in range(k): python_pybuffer.title2(b) print "Time used by string:", time.time() - t @@ -30,7 +30,7 @@ else: buf2 = bytearray(50) python_pybuffer.func1(buf1) - check(buf1 == b'a' * 10) + check(buf1 == b"a" * 10) python_pybuffer.func2(buf2) check(buf2.startswith(b"Hello world!\x00")) @@ -43,4 +43,4 @@ else: buf3 = bytearray(b"hello") python_pybuffer.title1(buf3) - check(buf3 == b'Hello') + check(buf3 == b"Hello") diff --git a/Examples/test-suite/python/python_strict_unicode_runme.py b/Examples/test-suite/python/python_strict_unicode_runme.py index afb9e8988..e7fae2556 100644 --- a/Examples/test-suite/python/python_strict_unicode_runme.py +++ b/Examples/test-suite/python/python_strict_unicode_runme.py @@ -1,8 +1,8 @@ import python_strict_unicode -test_bytes = b'hello \x01world\x99' -BYTES = b'BYTES' -test_unicode = u'h\udce9llo w\u00f6rld' +test_bytes = b"hello \x01world\x99" +BYTES = b"BYTES" +test_unicode = u"h\udce9llo w\u00f6rld" # Test that byte string inputs and outputs work as expected bdbl = python_strict_unicode.double_str(test_bytes) @@ -20,12 +20,12 @@ if type(bout) != type(BYTES): udbl = python_strict_unicode.double_wstr(test_unicode) if udbl != test_unicode + test_unicode: raise RuntimeError("Failed to double wide string") -if type(udbl) != type(u''): +if type(udbl) != type(u""): raise RuntimeError("Wrong type output for wide string") uout = python_strict_unicode.same_wstr(test_unicode) if uout != test_unicode: raise RuntimeError("Failed to copy wchar_t*") -if type(uout) != type(u''): +if type(uout) != type(u""): raise RuntimeError("Wrong type output for wchar_t*") # Test that overloading is handled properly @@ -35,9 +35,9 @@ if bovr != BYTES: if type(bovr) != type(BYTES): raise RuntimeError("Wrong type output from overload") uovr = python_strict_unicode.overload(test_unicode) -if uovr != u'UNICODE': +if uovr != u"UNICODE": raise RuntimeError("Failed to return unicode from overload") -if type(uovr) != type(u''): +if type(uovr) != type(u""): raise RuntimeERror("Wrong type output from overload") # Test that bytes aren't accepted as wide strings and unicode isn't accepted as narrow strings diff --git a/Examples/test-suite/python/reference_global_vars_runme.py b/Examples/test-suite/python/reference_global_vars_runme.py index 6c2d181ac..6f86527b7 100644 --- a/Examples/test-suite/python/reference_global_vars_runme.py +++ b/Examples/test-suite/python/reference_global_vars_runme.py @@ -13,8 +13,8 @@ cvar.var_bool = createref_bool(True) if value_bool(cvar.var_bool) != True: raise RuntimeError -cvar.var_char = createref_char('w') -if value_char(cvar.var_char) != 'w': +cvar.var_char = createref_char("w") +if value_char(cvar.var_char) != "w": raise RuntimeError cvar.var_unsigned_char = createref_unsigned_char(10) diff --git a/Examples/test-suite/python/std_containers_runme.py b/Examples/test-suite/python/std_containers_runme.py index 63ff74c2a..7404cd5f4 100644 --- a/Examples/test-suite/python/std_containers_runme.py +++ b/Examples/test-suite/python/std_containers_runme.py @@ -60,9 +60,9 @@ if mi[0][1] != mc[0][1]: map = {} -map['hello'] = 1 -map['hi'] = 2 -map['3'] = 2 +map["hello"] = 1 +map["hi"] = 2 +map["3"] = 2 imap = std_containers.mapident(map) for k in map: @@ -70,13 +70,13 @@ for k in map: raise RuntimeError, "bad map" # Test __contains__ (required for 'x in y' to work) -if not imap.__contains__('hello'): +if not imap.__contains__("hello"): raise RuntimeError("hello imap.__contains__") -if 'hello' not in imap: +if "hello" not in imap: raise RuntimeError("hello not in imap") -if imap.__contains__('oops'): +if imap.__contains__("oops"): raise RuntimeError("oops imap.__contains__") -if 'oops' in imap: +if "oops" in imap: raise RuntimeError("oops in imap") mapc = {} diff --git a/Examples/test-suite/python/swigobject_runme.py b/Examples/test-suite/python/swigobject_runme.py index 346b05d40..de232f580 100644 --- a/Examples/test-suite/python/swigobject_runme.py +++ b/Examples/test-suite/python/swigobject_runme.py @@ -15,11 +15,11 @@ lthis = long(a.this) # match pointer value, but deal with leading zeros on 8/16 bit systems and # different C++ compilers interpretation of %p xstr1 = "%016X" % (lthis,) -xstr1 = str.lstrip(xstr1, '0') +xstr1 = str.lstrip(xstr1, "0") xstr2 = pointer_str(a) xstr2 = str.replace(xstr2, "0x", "") xstr2 = str.replace(xstr2, "0X", "") -xstr2 = str.lstrip(xstr2, '0') +xstr2 = str.lstrip(xstr2, "0") xstr2 = str.upper(xstr2) if xstr1 != xstr2: diff --git a/Examples/test-suite/python/template_typedef_cplx2_runme.py b/Examples/test-suite/python/template_typedef_cplx2_runme.py index 3043d4285..161bd51fc 100644 --- a/Examples/test-suite/python/template_typedef_cplx2_runme.py +++ b/Examples/test-suite/python/template_typedef_cplx2_runme.py @@ -11,8 +11,8 @@ except: print d, "is not an instance" raise RuntimeError -s = '%s' % d -if str.find(s, 'ArithUnaryFunction') == -1: +s = "%s" % d +if str.find(s, "ArithUnaryFunction") == -1: print d, "is not an ArithUnaryFunction" raise RuntimeError @@ -23,8 +23,8 @@ except: print e, "is not an instance" raise RuntimeError -s = '%s' % e -if str.find(s, 'ArithUnaryFunction') == -1: +s = "%s" % e +if str.find(s, "ArithUnaryFunction") == -1: print e, "is not an ArithUnaryFunction" raise RuntimeError @@ -40,8 +40,8 @@ except: print c, "is not an instance" raise RuntimeError -s = '%s' % c -if str.find(s, 'ArithUnaryFunction') == -1: +s = "%s" % c +if str.find(s, "ArithUnaryFunction") == -1: print c, "is not an ArithUnaryFunction" raise RuntimeError @@ -52,8 +52,8 @@ except: print f, "is not an instance" raise RuntimeError -s = '%s' % f -if str.find(s, 'ArithUnaryFunction') == -1: +s = "%s" % f +if str.find(s, "ArithUnaryFunction") == -1: print f, "is not an ArithUnaryFunction" raise RuntimeError @@ -68,8 +68,8 @@ except: print g, "is not an instance" raise RuntimeError -s = '%s' % g -if str.find(s, 'ArithUnaryFunction') == -1: +s = "%s" % g +if str.find(s, "ArithUnaryFunction") == -1: print g, "is not an ArithUnaryFunction" raise RuntimeError @@ -81,8 +81,8 @@ except: print h, "is not an instance" raise RuntimeError -s = '%s' % h -if str.find(s, 'ArithUnaryFunction') == -1: +s = "%s" % h +if str.find(s, "ArithUnaryFunction") == -1: print h, "is not an ArithUnaryFunction" raise RuntimeError diff --git a/Examples/test-suite/python/template_typedef_cplx_runme.py b/Examples/test-suite/python/template_typedef_cplx_runme.py index afb97d070..1846739eb 100644 --- a/Examples/test-suite/python/template_typedef_cplx_runme.py +++ b/Examples/test-suite/python/template_typedef_cplx_runme.py @@ -11,8 +11,8 @@ except: print d, "is not an instance" raise RuntimeError -s = '%s' % d -if str.find(s, 'ArithUnaryFunction') == -1: +s = "%s" % d +if str.find(s, "ArithUnaryFunction") == -1: print d, "is not an ArithUnaryFunction" raise RuntimeError @@ -23,8 +23,8 @@ except: print e, "is not an instance" raise RuntimeError -s = '%s' % e -if str.find(s, 'ArithUnaryFunction') == -1: +s = "%s" % e +if str.find(s, "ArithUnaryFunction") == -1: print e, "is not an ArithUnaryFunction" raise RuntimeError @@ -40,8 +40,8 @@ except: print c, "is not an instance" raise RuntimeError -s = '%s' % c -if str.find(s, 'ArithUnaryFunction') == -1: +s = "%s" % c +if str.find(s, "ArithUnaryFunction") == -1: print c, "is not an ArithUnaryFunction" raise RuntimeError @@ -52,8 +52,8 @@ except: print f, "is not an instance" raise RuntimeError -s = '%s' % f -if str.find(s, 'ArithUnaryFunction') == -1: +s = "%s" % f +if str.find(s, "ArithUnaryFunction") == -1: print f, "is not an ArithUnaryFunction" raise RuntimeError @@ -68,8 +68,8 @@ except: print g, "is not an instance" raise RuntimeError -s = '%s' % g -if str.find(s, 'ArithUnaryFunction') == -1: +s = "%s" % g +if str.find(s, "ArithUnaryFunction") == -1: print g, "is not an ArithUnaryFunction" raise RuntimeError @@ -81,7 +81,7 @@ except: print h, "is not an instance" raise RuntimeError -s = '%s' % h -if str.find(s, 'ArithUnaryFunction') == -1: +s = "%s" % h +if str.find(s, "ArithUnaryFunction") == -1: print h, "is not an ArithUnaryFunction" raise RuntimeError diff --git a/Examples/test-suite/python/unicode_strings_runme.py b/Examples/test-suite/python/unicode_strings_runme.py index 39e93b0fc..4e661f00e 100644 --- a/Examples/test-suite/python/unicode_strings_runme.py +++ b/Examples/test-suite/python/unicode_strings_runme.py @@ -5,13 +5,13 @@ import unicode_strings # The 'u' string prefix isn't valid in Python 3.0 - 3.2 and is redundant # in 3.3+. Since this file is run through 2to3 before testing, though, # mark this as a unicode string in 2.x so it'll become a str in 3.x. -test_string = u'h\udce9llo w\u00f6rld' +test_string = u"h\udce9llo w\u00f6rld" if sys.version_info[0:2] >= (3, 1): if unicode_strings.non_utf8_c_str() != test_string: - raise ValueError('Test comparison mismatch') + raise ValueError("Test comparison mismatch") if unicode_strings.non_utf8_std_string() != test_string: - raise ValueError('Test comparison mismatch') + raise ValueError("Test comparison mismatch") def check(s1, s2): if s1 != s2: |