]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commitdiff
Ensure tuples are passed correctly in Revision.__repr__
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 11 Jul 2016 15:42:13 +0000 (11:42 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 11 Jul 2016 15:42:13 +0000 (11:42 -0400)
Fixed bug where a repr() or str() of a Script object would fail
if the script had multiple dependencies.

Change-Id: Iae866058cce4ec5a7dc499358b23b06a4bbb6ecd

alembic/script/revision.py
docs/build/changelog.rst
tests/test_revision.py

index c1750a066f2669f9131ff4906af8f10107fc6d69..3b4fac9c06cf447605317520c0c51efa4986f67a 100644 (file)
@@ -780,9 +780,9 @@ class Revision(object):
             repr(self.down_revision)
         ]
         if self.dependencies:
-            args.append("dependencies=%r" % self.dependencies)
+            args.append("dependencies=%r" % (self.dependencies,))
         if self.branch_labels:
-            args.append("branch_labels=%r" % self.branch_labels)
+            args.append("branch_labels=%r" % (self.branch_labels,))
         return "%s(%s)" % (
             self.__class__.__name__,
             ", ".join(args)
index 1308a293352df924b7c9907311460d8404a3d150..2ccc8b52512ac611256861cf483882f8a6cbbaa4 100644 (file)
@@ -6,6 +6,12 @@ Changelog
 .. changelog::
     :version: 0.8.7
 
+    .. change::
+      :tags: bug, versioning
+
+      Fixed bug where a repr() or str() of a Script object would fail
+      if the script had multiple dependencies.
+
     .. change::
       :tags: bug, autogenerate
 
index 45687eab8c2e102d8a1e095da13aed0a602ebd4d..498bea8d0f81b3d80a5f78991c4d75391484cbea 100644 (file)
@@ -111,6 +111,17 @@ class APITest(TestBase):
             ['c', 'b', 'a']
         )
 
+    def test_repr_revs(self):
+        map_ = RevisionMap(
+            lambda: [
+                Revision('a', ()),
+                Revision('b', ('a',)),
+                Revision('c', (), dependencies=('a', 'b')),
+            ]
+        )
+        c = map_._revision_map['c']
+        eq_(repr(c), "Revision('c', None, dependencies=('a', 'b'))")
+
 
 class DownIterateTest(TestBase):
     def _assert_iteration(