diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-10-21 15:06:41 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-10-21 15:06:41 -0400 |
| commit | 56976624169af6d0d329b4834ee9caa7243573dc (patch) | |
| tree | f57c8fe739c3213e87a686f002b8e66712991a6f /test/sql | |
| parent | 4663ec98b226a7d495846f0d89c646110705bb30 (diff) | |
| download | sqlalchemy-56976624169af6d0d329b4834ee9caa7243573dc.tar.gz | |
- Fixed bug where :func:`.type_coerce` would not interpret ORM
elements with a ``__clause_element__()`` method properly.
[ticket:2849]
Diffstat (limited to 'test/sql')
| -rw-r--r-- | test/sql/test_types.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/sql/test_types.py b/test/sql/test_types.py index a2791ee29..f739707f3 100644 --- a/test/sql/test_types.py +++ b/test/sql/test_types.py @@ -466,6 +466,17 @@ class UserDefinedTest(fixtures.TablesTest, AssertsCompiledSQL): 'd1BIND_OUT' ) + class MyFoob(object): + def __clause_element__(self): + return t.c.data + + eq_( + testing.db.execute( + select([t.c.data, type_coerce(MyFoob(), MyType)]) + ).fetchall(), + [('d1', 'd1BIND_OUT')] + ) + @classmethod def define_tables(cls, metadata): class MyType(types.UserDefinedType): |
