diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-07-19 10:00:13 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-07-19 10:00:13 -0400 |
| commit | 41aead96cdfd581c053a395992e1a3cf0b6a5572 (patch) | |
| tree | fceafc25ac4ae48d181f5d34a45d5b49149e381e /test/sql/test_functions.py | |
| parent | 18a078654da286c0adf51a20a21398e357ed12ed (diff) | |
| download | sqlalchemy-41aead96cdfd581c053a395992e1a3cf0b6a5572.tar.gz | |
- Fixed potential issue where a custom subclass
of :class:`.FunctionElement` or other column element that incorrectly
states 'None' or any other invalid object as the ``.type``
attribute will report this exception instead of recursion overflow.
fixes #3485
Diffstat (limited to 'test/sql/test_functions.py')
| -rw-r--r-- | test/sql/test_functions.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/test/sql/test_functions.py b/test/sql/test_functions.py index ec8d9b5c0..ccc9b2dcd 100644 --- a/test/sql/test_functions.py +++ b/test/sql/test_functions.py @@ -9,12 +9,12 @@ from sqlalchemy.sql.compiler import BIND_TEMPLATES from sqlalchemy.testing.engines import all_dialects from sqlalchemy import types as sqltypes from sqlalchemy.sql import functions -from sqlalchemy.sql.functions import GenericFunction +from sqlalchemy.sql.functions import GenericFunction, FunctionElement import decimal from sqlalchemy import testing from sqlalchemy.testing import fixtures, AssertsCompiledSQL, engines from sqlalchemy.dialects import sqlite, postgresql, mysql, oracle - +from sqlalchemy.testing import assert_raises_message table1 = table('mytable', column('myid', Integer), @@ -477,6 +477,18 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL): "AS anon_1 FROM mytable" ) + def test_incorrect_none_type(self): + class MissingType(FunctionElement): + name = 'mt' + type = None + + assert_raises_message( + TypeError, + "Object None associated with '.type' attribute is " + "not a TypeEngine class or object", + MissingType().compile + ) + class ExecuteTest(fixtures.TestBase): |
