Accommodate tuples for ColumnDefault.__repr__

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
(cherry picked from commit 5acc9b149a)
This commit is contained in:
Nicolas CANIART
2017-10-31 11:34:10 -04:00
committed by Mike Bayer
parent a92f6316ed
commit d91edf2511
3 changed files with 9 additions and 1 deletions
+7
View File
@@ -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.
+1 -1
View File
@@ -2081,7 +2081,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):
+1
View 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),