Convert python test scripts to be Python 2 and 3 compatible

Unicode testing
This commit is contained in:
William S Fulton 2020-08-15 00:09:31 +01:00
commit 66df0bd224
6 changed files with 28 additions and 30 deletions

View file

@ -5,10 +5,10 @@ def check_equal(a, b):
if a != b:
raise RuntimeError("failed {} {}".format(a, b))
h = u"h"
h = "h"
check_equal(li_std_wstring.test_wcvalue(h), h)
x = u"abc"
x = "abc"
check_equal(li_std_wstring.test_ccvalue(x), x)
check_equal(li_std_wstring.test_cvalue(x), x)
@ -72,7 +72,7 @@ except TypeError:
# Check surrogateescape
if sys.version_info[0:2] > (3, 1):
x = u"h\udce9llo" # surrogate escaped representation of C char*: "h\xe9llo"
x = "h\udce9llo" # surrogate escaped representation of C char*: "h\xe9llo"
if li_std_wstring.non_utf8_c_str() != x:
raise RuntimeError("surrogateescape not working")
if li_std_wstring.size_wstring(x) != 5 and len(x) != 5: