diff options
author | Michael Trier <mtrier@gmail.com> | 2009-01-22 01:46:04 +0000 |
---|---|---|
committer | Michael Trier <mtrier@gmail.com> | 2009-01-22 01:46:04 +0000 |
commit | 52e2c2d916fb45d8169d6b273db2b39b0fc8ccee (patch) | |
tree | 69445fe6a8ee22ec1eb0e98af222bc18647c3928 /test/dialect/mssql.py | |
parent | 7c56371f81707b5979249b2f2b056f65488f1bab (diff) | |
download | sqlalchemy-52e2c2d916fb45d8169d6b273db2b39b0fc8ccee.tar.gz |
Restored convert_unicode handling on mssql. Fixes #1291.
Diffstat (limited to 'test/dialect/mssql.py')
-rwxr-xr-x | test/dialect/mssql.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/dialect/mssql.py b/test/dialect/mssql.py index f0b0bec76..08ddfd5a1 100755 --- a/test/dialect/mssql.py +++ b/test/dialect/mssql.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 import testenv; testenv.configure_for_tests() import datetime, os, pickleable, re from sqlalchemy import * @@ -144,6 +145,28 @@ class ReflectionTest(TestBase): table.drop() +class QueryUnicodeTest(TestBase): + __only_on__ = 'mssql' + + def test_convert_unicode(self): + meta = MetaData(testing.db) + t1 = Table('unitest_table', meta, + Column('id', Integer, primary_key=True), + Column('descr', mssql.MSText(200, convert_unicode=True))) + meta.create_all() + con = testing.db.connect() + + # encode in UTF-8 (sting object) because this is the default dialect encoding + con.execute(u"insert into unitest_table values ('bien mangé')".encode('UTF-8')) + + try: + r = t1.select().execute().fetchone() + assert isinstance(r[1], unicode), '%s is %s instead of unicode, working on %s' % ( + r[1], type(r[1]), meta.bind) + + finally: + meta.drop_all() + class QueryTest(TestBase): __only_on__ = 'mssql' |