summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAngus Lees <gus@inodes.org>2014-07-04 18:06:34 +1000
committerAngus Lees <gus@inodes.org>2014-07-10 11:25:44 +1000
commit2081502bfdf7414298d0b2c59cc74852536ce78f (patch)
tree73bd6a1dcbc4089d7a80150b1cd0ba95a4cad5e7 /test
parente0a9b94abb92c6b62d6a6f70dec680d7ca35eed6 (diff)
downloadsqlalchemy-pr/102.tar.gz
Tell mysql that Unicode columns are unicodepr/102
Without this patch, Unicode columns get no special charset by default, and fall back to whatever the table, database, server configuration and (eventually) server hardcoded default encoding is. The hardcoded default mysql encoding is latin1. This change maps Unicode to NVARCHAR (for consistency with other sqlalchemy dialects), and UnicodeText to 'TEXT UNICODE'.
Diffstat (limited to 'test')
-rw-r--r--test/dialect/mysql/test_types.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/test/dialect/mysql/test_types.py b/test/dialect/mysql/test_types.py
index b7d261a88..587218266 100644
--- a/test/dialect/mysql/test_types.py
+++ b/test/dialect/mysql/test_types.py
@@ -238,7 +238,13 @@ class TypesTest(fixtures.TestBase, AssertsExecutionResults, AssertsCompiledSQL):
(mysql.ENUM, ["foo", "bar"], {'unicode':True},
'''ENUM('foo','bar') UNICODE'''),
- (String, [20], {"collation": "utf8"}, 'VARCHAR(20) COLLATE utf8')
+ (String, [20], {"collation": "utf8"}, 'VARCHAR(20) COLLATE utf8'),
+
+ (Unicode, [20], {}, 'NATIONAL VARCHAR(20)'),
+
+ (UnicodeText, [], {}, 'TEXT UNICODE'),
+
+ (UnicodeText, [20], {}, 'TEXT(20) UNICODE'),
]
@@ -252,7 +258,7 @@ class TypesTest(fixtures.TestBase, AssertsExecutionResults, AssertsCompiledSQL):
# test that repr() copies out all arguments
self.assert_compile(
eval("mysql.%r" % type_inst)
- if type_ is not String
+ if type_ not in (String, Unicode, UnicodeText)
else eval("%r" % type_inst),
res
)
@@ -820,4 +826,3 @@ class EnumSetTest(fixtures.TestBase, AssertsExecutionResults, AssertsCompiledSQL
def colspec(c):
return testing.db.dialect.ddl_compiler(
testing.db.dialect, None).get_column_specification(c)
-