Merge pull request #70 from adarshk7/master

Add separator to exception message in ScalarListType
This commit is contained in:
Konsta Vesterinen
2014-03-13 17:20:14 +02:00
2 changed files with 7 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 "
"separator. If you wish for scalar list values to contain "
"these strings, use a different separator string.)"
% self.separator
)
return self.separator.join(
map(six.text_type, value)

View File

@@ -47,8 +47,13 @@ class TestScalarUnicodeList(TestCase):
)
self.session.add(user)
with raises(sa.exc.StatementError):
with raises(sa.exc.StatementError) as db_err:
self.session.commit()
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 str(db_err.value)
def test_save_unicode_list(self):
user = self.User(