Add separator to exception message in ScalarListType

This commit is contained in:
Adarsh Krishnan
2014-03-12 10:20:48 +02:00
parent 49cc6f2f04
commit ed79073802
2 changed files with 8 additions and 1 deletions

View File

@@ -67,6 +67,7 @@ class ScalarListType(types.TypeDecorator):
"List values can't contain string '%s' (its being used as " "List values can't contain string '%s' (its being used as "
"separator. If you wish for scalar list values to contain " "separator. If you wish for scalar list values to contain "
"these strings, use a different separator string.)" "these strings, use a different separator string.)"
% self.separator
) )
return self.separator.join( return self.separator.join(
map(six.text_type, value) map(six.text_type, value)

View File

@@ -47,8 +47,14 @@ class TestScalarUnicodeList(TestCase):
) )
self.session.add(user) self.session.add(user)
with raises(sa.exc.StatementError): with raises(sa.exc.StatementError) as db_err:
self.session.commit() self.session.commit()
print db_err.value.message
assert (
"List values can't contain string ',' (its being used as "
"separator. If you wish for scalar list values to contain "
"these strings, use a different separator string.)"
) in db_err.value.message
def test_save_unicode_list(self): def test_save_unicode_list(self):
user = self.User( user = self.User(