]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Accommodate tuples for ColumnDefault.__repr__
authorNicolas CANIART <nicolas@caniart.net>
Tue, 31 Oct 2017 15:34:10 +0000 (11:34 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 31 Oct 2017 15:38:07 +0000 (11:38 -0400)
Fixed bug where ``__repr__`` of :class:`.ColumnDefault` would fail
if the argument were a tuple.  Pull request courtesy Nicolas Caniart.

Change-Id: I08aa2448ef91054c43d6068ac54cedbdf7a83d64
Pull-request: https://bitbucket.org/zzzeek/sqlalchemy/pull-requests/1
Fixes: #4126
doc/build/changelog/unreleased_11/4126.rst [new file with mode: 0644]
lib/sqlalchemy/sql/schema.py
test/sql/test_metadata.py

diff --git a/doc/build/changelog/unreleased_11/4126.rst b/doc/build/changelog/unreleased_11/4126.rst
new file mode 100644 (file)
index 0000000..f269f1c
--- /dev/null
@@ -0,0 +1,7 @@
+.. change::
+    :tags: bug, sql
+    :tickets: 4126
+    :versions: 1.2.0b4
+
+    Fixed bug where ``__repr__`` of :class:`.ColumnDefault` would fail
+    if the argument were a tuple.  Pull request courtesy Nicolas Caniart.
\ No newline at end of file
index 446d0118bb03c79788afbe129827aeab79c7a67c..683da823f263137c126d830e5d7640bee25a063b 100644 (file)
@@ -2111,7 +2111,7 @@ class ColumnDefault(DefaultGenerator):
     __visit_name__ = property(_visit_name)
 
     def __repr__(self):
-        return "ColumnDefault(%r)" % self.arg
+        return "ColumnDefault(%r)" % (self.arg, )
 
 
 class Sequence(DefaultGenerator):
index 98b98fec3f0545cd1b0eb8a84edc162b8e6d79a7..7071782c41a9ee9f8a2aa69c70c1c2f6dd2d4b4b 100644 (file)
@@ -550,6 +550,7 @@ class MetaDataTest(fixtures.TestBase, ComparesTables):
              "CheckConstraint("
              "%s"
              ", name='someconstraint')" % repr(ck.sqltext)),
+            (ColumnDefault(('foo', 'bar')), "ColumnDefault(('foo', 'bar'))")
         ):
             eq_(
                 repr(const),