Convert python tests using 2to3
These tests were converted using 2to3 and should be valid using Python 2.7 and Python 3+.
This commit is contained in:
parent
66df0bd224
commit
d4ffa46f41
66 changed files with 551 additions and 551 deletions
|
|
@ -4,16 +4,16 @@ x = "hello"
|
|||
|
||||
|
||||
if li_std_string_extra.test_ccvalue(x) != x:
|
||||
raise RuntimeError, "bad string mapping"
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
if li_std_string_extra.test_cvalue(x) != x:
|
||||
raise RuntimeError, "bad string mapping"
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
if li_std_string_extra.test_value(x) != x:
|
||||
raise RuntimeError("bad string mapping {} {}".format(x, li_std_string_extra.test_value(x)))
|
||||
|
||||
if li_std_string_extra.test_const_reference(x) != x:
|
||||
raise RuntimeError, "bad string mapping"
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
|
||||
s = li_std_string_extra.string("he")
|
||||
|
|
@ -25,21 +25,21 @@ if s != x:
|
|||
raise RuntimeError("bad string mapping {} {}".format(s, x))
|
||||
|
||||
if s[1:4] != x[1:4]:
|
||||
raise RuntimeError, "bad string mapping"
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
if li_std_string_extra.test_value(s) != x:
|
||||
raise RuntimeError, "bad string mapping"
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
if li_std_string_extra.test_const_reference(s) != x:
|
||||
raise RuntimeError, "bad string mapping"
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
a = li_std_string_extra.A(s)
|
||||
|
||||
if li_std_string_extra.test_value(a) != x:
|
||||
raise RuntimeError, "bad string mapping"
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
if li_std_string_extra.test_const_reference(a) != x:
|
||||
raise RuntimeError, "bad string mapping"
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
b = li_std_string_extra.string(" world")
|
||||
|
||||
|
|
@ -48,17 +48,17 @@ if a + b != "hello world":
|
|||
raise RuntimeError("bad string mapping {}".format(a + b))
|
||||
|
||||
if a + " world" != "hello world":
|
||||
raise RuntimeError, "bad string mapping"
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
# This is expected to fail with -builtin option
|
||||
# Reverse operators not supported in builtin types
|
||||
if not li_std_string_extra.is_python_builtin():
|
||||
if "hello" + b != "hello world":
|
||||
raise RuntimeError, "bad string mapping"
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
c = "hello" + b
|
||||
if c.find_last_of("l") != 9:
|
||||
raise RuntimeError, "bad string mapping"
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
s = "hello world"
|
||||
|
||||
|
|
@ -66,33 +66,33 @@ b = li_std_string_extra.B("hi")
|
|||
|
||||
b.name = li_std_string_extra.string("hello")
|
||||
if b.name != "hello":
|
||||
raise RuntimeError, "bad string mapping"
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
|
||||
b.a = li_std_string_extra.A("hello")
|
||||
if b.a != "hello":
|
||||
raise RuntimeError, "bad string mapping"
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
|
||||
if li_std_string_extra.test_value_basic1(x) != x:
|
||||
raise RuntimeError, "bad string mapping"
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
if li_std_string_extra.test_value_basic2(x) != x:
|
||||
raise RuntimeError, "bad string mapping"
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
|
||||
if li_std_string_extra.test_value_basic3(x) != x:
|
||||
raise RuntimeError, "bad string mapping"
|
||||
raise RuntimeError("bad string mapping")
|
||||
|
||||
if li_std_string_extra.test_value_basic_overload(x) != x:
|
||||
raise RuntimeError, "bad overload string"
|
||||
raise RuntimeError("bad overload string")
|
||||
|
||||
if li_std_string_extra.test_value_basic_overload(123) != "int":
|
||||
raise RuntimeError, "bad overload int"
|
||||
raise RuntimeError("bad overload int")
|
||||
|
||||
try:
|
||||
li_std_string_extra.test_value_basic_overload([x])
|
||||
raise RuntimeError, "should throw TypeError"
|
||||
raise RuntimeError("should throw TypeError")
|
||||
except TypeError as e:
|
||||
if str(e).find("Possible C/C++ prototypes are:") == -1:
|
||||
raise RuntimeError("Incorrect error message text:\n{}".format(e))
|
||||
|
|
@ -100,7 +100,7 @@ except TypeError as e:
|
|||
|
||||
try:
|
||||
li_std_string_extra.test_value_basic_overload([123])
|
||||
raise RuntimeError, "should throw TypeError"
|
||||
raise RuntimeError("should throw TypeError")
|
||||
except TypeError as e:
|
||||
if str(e).find("Possible C/C++ prototypes are:") == -1:
|
||||
raise RuntimeError("Incorrect error message text:\n{}".format(e))
|
||||
|
|
@ -109,30 +109,30 @@ except TypeError as e:
|
|||
# Global variables
|
||||
s = "initial string"
|
||||
if li_std_string_extra.cvar.GlobalString2 != "global string 2":
|
||||
raise RuntimeError, "GlobalString2 test 1"
|
||||
raise RuntimeError("GlobalString2 test 1")
|
||||
li_std_string_extra.cvar.GlobalString2 = s
|
||||
if li_std_string_extra.cvar.GlobalString2 != s:
|
||||
raise RuntimeError, "GlobalString2 test 2"
|
||||
raise RuntimeError("GlobalString2 test 2")
|
||||
if li_std_string_extra.cvar.ConstGlobalString != "const global string":
|
||||
raise RuntimeError, "ConstGlobalString test"
|
||||
raise RuntimeError("ConstGlobalString test")
|
||||
|
||||
# Member variables
|
||||
myStructure = li_std_string_extra.Structure()
|
||||
if myStructure.MemberString2 != "member string 2":
|
||||
raise RuntimeError, "MemberString2 test 1"
|
||||
raise RuntimeError("MemberString2 test 1")
|
||||
myStructure.MemberString2 = s
|
||||
if myStructure.MemberString2 != s:
|
||||
raise RuntimeError, "MemberString2 test 2"
|
||||
raise RuntimeError("MemberString2 test 2")
|
||||
if myStructure.ConstMemberString != "const member string":
|
||||
raise RuntimeError, "ConstMemberString test"
|
||||
raise RuntimeError("ConstMemberString test")
|
||||
|
||||
if li_std_string_extra.cvar.Structure_StaticMemberString2 != "static member string 2":
|
||||
raise RuntimeError, "StaticMemberString2 test 1"
|
||||
raise RuntimeError("StaticMemberString2 test 1")
|
||||
li_std_string_extra.cvar.Structure_StaticMemberString2 = s
|
||||
if li_std_string_extra.cvar.Structure_StaticMemberString2 != s:
|
||||
raise RuntimeError, "StaticMemberString2 test 2"
|
||||
raise RuntimeError("StaticMemberString2 test 2")
|
||||
if li_std_string_extra.cvar.Structure_ConstStaticMemberString != "const static member string":
|
||||
raise RuntimeError, "ConstStaticMemberString test"
|
||||
raise RuntimeError("ConstStaticMemberString test")
|
||||
|
||||
|
||||
if li_std_string_extra.test_reference_input("hello") != "hello":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue