From: Dimitris Theodorou Date: Mon, 12 Jan 2015 01:40:50 +0000 (+0100) Subject: Add native_enum flag to Enum's repr() result X-Git-Tag: rel_1_0_0b1~119 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f4b7b02e31e6b49195c21da7221bcbda0bad02b9;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Add native_enum flag to Enum's repr() result Needed for alembic autogenerate rendering. --- diff --git a/lib/sqlalchemy/sql/sqltypes.py b/lib/sqlalchemy/sql/sqltypes.py index 9b0d266013..bd1914da3e 100644 --- a/lib/sqlalchemy/sql/sqltypes.py +++ b/lib/sqlalchemy/sql/sqltypes.py @@ -1146,6 +1146,7 @@ class Enum(String, SchemaType): def __repr__(self): return util.generic_repr(self, + additional_kw=[('native_enum', True)], to_inspect=[Enum, SchemaType], ) diff --git a/test/sql/test_types.py b/test/sql/test_types.py index 26dc6c8425..0212499c42 100644 --- a/test/sql/test_types.py +++ b/test/sql/test_types.py @@ -1157,8 +1157,8 @@ class EnumTest(AssertsCompiledSQL, fixtures.TestBase): def test_repr(self): e = Enum( "x", "y", name="somename", convert_unicode=True, quote=True, - inherit_schema=True) - eq_(repr(e), "Enum('x', 'y', name='somename', inherit_schema=True)") + inherit_schema=True, native_enum=False) + eq_(repr(e), "Enum('x', 'y', name='somename', inherit_schema=True, native_enum=False)") binary_table = MyPickleType = metadata = None