]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commitdiff
- add a test for Enum repr() - requires SQLA 0.7.9 or 0.8
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 8 Aug 2012 23:45:13 +0000 (19:45 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 8 Aug 2012 23:45:13 +0000 (19:45 -0400)
tests/test_autogenerate.py

index 2edd8693de6b705764416f3f27ca6e9c7d6baf69..ecf2c3ed9dfdd4f2509382a90a6d954283bb9234 100644 (file)
@@ -1,6 +1,6 @@
 from sqlalchemy import MetaData, Column, Table, Integer, String, Text, \
     Numeric, CHAR, ForeignKey, DATETIME, \
-    TypeDecorator, CheckConstraint, Unicode,\
+    TypeDecorator, CheckConstraint, Unicode, Enum,\
     UniqueConstraint, Boolean
 from sqlalchemy.types import NULLTYPE
 from sqlalchemy.dialects import mysql
@@ -566,4 +566,20 @@ class AutogenRenderTest(TestCase):
             "existing_server_default='5')"
         )
 
+    def test_render_enum(self):
+        eq_ignore_whitespace(
+            autogenerate._repr_type(
+                        "sa.",
+                        Enum("one", "two", "three", name="myenum"),
+                        self.autogen_context),
+            "sa.Enum('one', 'two', 'three', name='myenum')"
+        )
+        eq_ignore_whitespace(
+            autogenerate._repr_type(
+                        "sa.",
+                        Enum("one", "two", "three"),
+                        self.autogen_context),
+            "sa.Enum('one', 'two', 'three')"
+        )
+
 # TODO: tests for dialect-specific type rendering + imports