better error messages with list
This commit is contained in:
@ -99,12 +99,12 @@ def test_consistency_error_prefix():
|
||||
try:
|
||||
api.option('b').value.set(1)
|
||||
except Exception as err:
|
||||
assert str(err) == _('"{0}" is an invalid {1} for "{2}"').format('1', _('integer'), 'b') + ', ' + _('must be different from the value of "{}"').format('a')
|
||||
assert str(err) == _('"{0}" is an invalid {1} for "{2}"').format('1', _('integer'), 'b') + ', ' + _('must be different from the value of {}').format('"a"')
|
||||
try:
|
||||
api.option('b').value.set(1)
|
||||
except Exception as err:
|
||||
err.prefix = ''
|
||||
assert str(err) == _('must be different from the value of "{}"').format('a')
|
||||
assert str(err) == _('must be different from the value of {}').format('"a"')
|
||||
|
||||
|
||||
def test_consistency_warnings_only_option():
|
||||
|
@ -621,9 +621,9 @@ def test_pprint():
|
||||
except PropertiesOptionError as error:
|
||||
err = error
|
||||
|
||||
list_disabled = '"disabled" (' + display_list([msg_is.format('Test int option', '"1"'), msg_is.format('string2', '"string"')]) + ')'
|
||||
list_disabled = '"disabled" (' + display_list([msg_is.format('Test int option', '"1"'), msg_is.format('string2', '"string"')], add_quote=False) + ')'
|
||||
list_hidden = '"hidden" (' + msg_is_not.format('Test int option', display_list([2, 3, 4], 'or', add_quote=True)) + ')'
|
||||
assert str(err) == _(msg_error.format('option', 'Test string option', properties, display_list([list_disabled, list_hidden])))
|
||||
assert str(err) == _(msg_error.format('option', 'Test string option', properties, display_list([list_disabled, list_hidden], add_quote=False)))
|
||||
del err
|
||||
|
||||
err = None
|
||||
|
Reference in New Issue
Block a user