Commit e6570490 authored by Kirill Smelkov's avatar Kirill Smelkov

golang_str: tests: Fix test_strings_methods wrt upcoming str=bstr and unicode=ustr

When gpython will start patching builtin str and unicode types with bstr
and ustr the first argument to assertDeepEQ will have builtin str or
unicode type and the existing

    assert not isinstance(a, (bstr, ustr))

will break.

-> Rewrite that assert to do equivalent check carefully that does not
break when str/unicode types are patched with bstr and ustr.
parent c596ab9c
......@@ -1713,7 +1713,11 @@ def test_strings_methods():
ur = xcall(us, meth, *argv, **kw)
def assertDeepEQ(a, b, bstrtype):
assert not isinstance(a, (bstr, ustr))
# `assert not isinstance(a, (bstr, ustr))` done carefully not to
# break when bytes/unicode are patched with bstr/ustr
if isinstance(a, bytes): assert type(a) is bytes
if isinstance(a, unicode): assert type(a) is unicode
if type(a) is unicode:
assert type(b) is bstrtype
assert a == b
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment