diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-12-18 18:26:15 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-12-18 18:26:15 -0500 |
| commit | 2692238f45ae4d2f46949dfa52b16132bd266e0e (patch) | |
| tree | 3ea336d98a01461b51da530bf0aca155b891fdd0 /test/dialect | |
| parent | f701f87c1374c1e4d80b9f47c17632518cece765 (diff) | |
| download | sqlalchemy-2692238f45ae4d2f46949dfa52b16132bd266e0e.tar.gz | |
- Improvements to the system by which SQL types generate within
``__repr__()``, particularly with regards to the MySQL integer/numeric/
character types which feature a wide variety of keyword arguments.
The ``__repr__()`` is important for use with Alembic autogenerate
for when Python code is rendered in a migration script.
[ticket:2893]
Diffstat (limited to 'test/dialect')
| -rw-r--r-- | test/dialect/mysql/test_types.py | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/test/dialect/mysql/test_types.py b/test/dialect/mysql/test_types.py index 071b8440f..cd6cba18e 100644 --- a/test/dialect/mysql/test_types.py +++ b/test/dialect/mysql/test_types.py @@ -142,8 +142,15 @@ class TypesTest(fixtures.TestBase, AssertsExecutionResults, AssertsCompiledSQL): ] for type_, args, kw, res in columns: + type_inst = type_(*args, **kw) self.assert_compile( - type_(*args, **kw), + type_inst, + res + ) + # test that repr() copies out all arguments + print "mysql.%r" % type_inst + self.assert_compile( + eval("mysql.%r" % type_inst), res ) @@ -233,14 +240,22 @@ 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') ] for type_, args, kw, res in columns: + type_inst = type_(*args, **kw) + self.assert_compile( + type_inst, + res + ) + # test that repr() copies out all arguments self.assert_compile( - type_(*args, **kw), + eval("mysql.%r" % type_inst) + if type_ is not String + else eval("%r" % type_inst), res ) |
