remove unicode decode error
This commit is contained in:
@ -54,7 +54,7 @@ def test_domainname_upper():
|
||||
if sys.version_info[0] >= 3: # pragma: optional cover
|
||||
assert msg in str(err)
|
||||
else:
|
||||
assert msg in unicode(err)
|
||||
assert msg in str(err)
|
||||
has_error = True
|
||||
assert has_error is True
|
||||
has_error = False
|
||||
@ -64,7 +64,7 @@ def test_domainname_upper():
|
||||
if sys.version_info[0] >= 3: # pragma: optional cover
|
||||
assert msg in str(err)
|
||||
else:
|
||||
assert msg in unicode(err)
|
||||
assert msg in str(err)
|
||||
has_error = True
|
||||
assert has_error is True
|
||||
|
||||
|
@ -489,9 +489,11 @@ def test_reset_properties_force_store_value():
|
||||
|
||||
|
||||
def test_pprint():
|
||||
msg_error = _('cannot access to {} "{}" because has {} {}')
|
||||
msg_error = _("cannot access to {0} \"{1}\" because has {2} {3}")
|
||||
msg_is = _('the value of "{0}" is "{1}"')
|
||||
msg_is_not = _('the value of "{0}" is not "{1}"')
|
||||
properties = _('properties')
|
||||
prop = _('property')
|
||||
|
||||
s = StrOption("string", "", default=["string"], default_multi="string", multi=True, properties=('hidden', 'disabled'))
|
||||
s2 = StrOption("string2", "", default="string")
|
||||
@ -522,10 +524,10 @@ def test_pprint():
|
||||
list_disabled_1 = 'disabled (' + display_list([msg_is.format('string2', 'string'), msg_is.format('Test int option', '1')]) + ')'
|
||||
list_disabled_2 = 'disabled (' + display_list([msg_is.format('Test int option', '1'), msg_is.format('string2', 'string')]) + ')'
|
||||
list_hidden = 'hidden (' + msg_is_not.format('Test int option', display_list([2, 3, 4], 'or')) + ')'
|
||||
comp1 = str(err) == msg_error.format('option', 'Test string option', 'properties', display_list([list_disabled_1, list_hidden]))
|
||||
comp2 = str(err) == msg_error.format('option', 'Test string option', 'properties', display_list([list_disabled_2, list_hidden]))
|
||||
comp3 = str(err) == msg_error.format('option', 'Test string option', 'properties', display_list([list_hidden, list_disabled_1]))
|
||||
comp4 = str(err) == msg_error.format('option', 'Test string option', 'properties', display_list([list_hidden, list_disabled_2]))
|
||||
comp1 = str(err) == _(msg_error.format('option', 'Test string option', properties, display_list([list_disabled_1, list_hidden])))
|
||||
comp2 = str(err) == _(msg_error.format('option', 'Test string option', properties, display_list([list_disabled_2, list_hidden])))
|
||||
comp3 = str(err) == _(msg_error.format('option', 'Test string option', properties, display_list([list_hidden, list_disabled_1])))
|
||||
comp4 = str(err) == _(msg_error.format('option', 'Test string option', properties, display_list([list_hidden, list_disabled_2])))
|
||||
assert comp1 or comp2 or comp3 or comp4
|
||||
|
||||
try:
|
||||
@ -533,7 +535,7 @@ def test_pprint():
|
||||
except Exception, err:
|
||||
pass
|
||||
|
||||
assert str(err) == msg_error.format('optiondescription', 'options', 'property', 'hidden (' + msg_is.format('Test int option', 1) + ')')
|
||||
assert str(err) == msg_error.format('optiondescription', 'options', prop, 'hidden (' + msg_is.format('Test int option', 1) + ')')
|
||||
|
||||
try:
|
||||
config.val3
|
||||
@ -544,17 +546,17 @@ def test_pprint():
|
||||
msg_3 = msg_is_not.format('Test int option', display_list([2, 3, 4], 'or'))
|
||||
|
||||
list_hidden = 'hidden (' + display_list([msg_1, msg_2, msg_3]) + ')'
|
||||
comp1 = str(err) == msg_error.format('option', 'val3', 'property', list_hidden)
|
||||
comp1 = str(err) == msg_error.format('option', 'val3', prop, list_hidden)
|
||||
list_hidden = 'hidden (' + display_list([msg_1, msg_3, msg_2]) + ')'
|
||||
comp2 = str(err) == msg_error.format('option', 'val3', 'property', list_hidden)
|
||||
comp2 = str(err) == msg_error.format('option', 'val3', prop, list_hidden)
|
||||
list_hidden = 'hidden (' + display_list([msg_2, msg_1, msg_3]) + ')'
|
||||
comp3 = str(err) == msg_error.format('option', 'val3', 'property', list_hidden)
|
||||
comp3 = str(err) == msg_error.format('option', 'val3', prop, list_hidden)
|
||||
list_hidden = 'hidden (' + display_list([msg_2, msg_3, msg_1]) + ')'
|
||||
comp4 = str(err) == msg_error.format('option', 'val3', 'property', list_hidden)
|
||||
comp4 = str(err) == msg_error.format('option', 'val3', prop, list_hidden)
|
||||
list_hidden = 'hidden (' + display_list([msg_3, msg_1, msg_2]) + ')'
|
||||
comp5 = str(err) == msg_error.format('option', 'val3', 'property', list_hidden)
|
||||
comp5 = str(err) == msg_error.format('option', 'val3', prop, list_hidden)
|
||||
list_hidden = 'hidden (' + display_list([msg_3, msg_2, msg_1]) + ')'
|
||||
comp6 = str(err) == msg_error.format('option', 'val3', 'property', list_hidden)
|
||||
comp6 = str(err) == msg_error.format('option', 'val3', prop, list_hidden)
|
||||
assert comp1 or comp2 or comp3 or comp4 or comp5 or comp6
|
||||
|
||||
try:
|
||||
@ -562,11 +564,11 @@ def test_pprint():
|
||||
except Exception, err:
|
||||
pass
|
||||
|
||||
assert str(err) == msg_error.format('option', 'string', 'properties', display_list(['disabled', 'hidden']))
|
||||
assert str(err) == msg_error.format('option', 'string', properties, display_list(['disabled', 'hidden']))
|
||||
|
||||
try:
|
||||
config.string3
|
||||
except Exception, err:
|
||||
pass
|
||||
|
||||
assert str(err) == msg_error.format('option', 'string3', 'property', 'hidden')
|
||||
assert str(err) == msg_error.format('option', 'string3', prop, 'hidden')
|
||||
|
Reference in New Issue
Block a user