]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Add native_enum flag to Enum's repr() result
authorDimitris Theodorou <dimitris.theodorou@gmail.com>
Mon, 12 Jan 2015 01:40:50 +0000 (02:40 +0100)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 12 Jan 2015 18:27:07 +0000 (13:27 -0500)
Needed for alembic autogenerate rendering.

(cherry picked from commit f4b7b02e31e6b49195c21da7221bcbda0bad02b9)

Conflicts:
test/sql/test_types.py

lib/sqlalchemy/sql/sqltypes.py
test/sql/test_types.py

index a7f25bbfa4dd9e6f41173cedf91646c835ecbbda..c11869f4c4b5efb5bd3d4789e1a7e3713bd7a405 100644 (file)
@@ -1145,6 +1145,7 @@ class Enum(String, SchemaType):
 
     def __repr__(self):
         return util.generic_repr(self,
+                                 additional_kw=[('native_enum', True)],
                                  to_inspect=[Enum, SchemaType],
                                  )
 
index 20ba9d3ef24e082fb31611f08c067979af5db072..fd7dafc84406e190593ae9f7c8e2cec64353962a 100644 (file)
@@ -1155,12 +1155,15 @@ class EnumTest(AssertsCompiledSQL, fixtures.TestBase):
         assert "('x'," in e.print_sql()
 
     def test_repr(self):
-        e = Enum("x", "y", name="somename", convert_unicode=True,
-                 quote=True, inherit_schema=True)
+        e = Enum(
+            "x", "y", name="somename", convert_unicode=True, quote=True,
+            inherit_schema=True, native_enum=False)
         eq_(
             repr(e),
-            "Enum('x', 'y', name='somename', inherit_schema=True)"
-        )
+            "Enum('x', 'y', name='somename', "
+            "inherit_schema=True, native_enum=False)")
+
+binary_table = MyPickleType = metadata = None
 
 
 class BinaryTest(fixtures.TestBase, AssertsExecutionResults):