]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
apply sorting to overlaps message
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 2 Jun 2021 19:56:15 +0000 (15:56 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 2 Jun 2021 19:56:15 +0000 (15:56 -0400)
so that string comparison tests are deterministic

Change-Id: Ia072f225fb906ea43c451eb4217856f144932fd2

lib/sqlalchemy/orm/relationships.py
test/orm/test_relationships.py

index 171df3e21ac8d019a0e39d0b0bd5da7b5694b32c..2d1ed6ced8be9487a0602e73feb7a9ca976e3768 100644 (file)
@@ -3459,10 +3459,12 @@ class JoinCondition(object):
                             from_,
                             to_,
                             ", ".join(
-                                "'%s' (copies %s to %s)" % (pr, fr_, to_)
-                                for (pr, fr_) in other_props
+                                sorted(
+                                    "'%s' (copies %s to %s)" % (pr, fr_, to_)
+                                    for (pr, fr_) in other_props
+                                )
                             ),
-                            ",".join(pr.key for pr, fr in other_props),
+                            ",".join(sorted(pr.key for pr, fr in other_props)),
                             self.prop,
                         ),
                         code="qzyx",
index e14db9f8031418f65a021b2fd9049f3835635c25..8f622d705e5f7f54d0d984ada824bb1a14754c1f 100644 (file)
@@ -913,32 +913,32 @@ class OverlappingFksSiblingTest(fixtures.TestBase):
             with expect_warnings(
                 r"relationship 'A.bs' will copy column a.id to column b.a_id, "
                 r"which conflicts with relationship\(s\): "
-                r"'C.as' \(copies a.id to b.a_id\), "
-                r"'A.cs' \(copies a.id to b.a_id\)"
+                r"'A.cs' \(copies a.id to b.a_id\), "
+                r"'C.as' \(copies a.id to b.a_id\)"
                 r".*add the parameter 'overlaps=\"as,cs\"' to the 'A.bs' "
                 r"relationship",
                 #
                 #
                 r"relationship 'B.a' will copy column a.id to column b.a_id, "
                 r"which conflicts with relationship\(s\): "
-                r"'C.as' \(copies a.id to b.a_id\), "
-                r"'A.cs' \(copies a.id to b.a_id\)..*"
-                r"add the parameter 'overlaps=\"as,cs\"' to the 'B.a' "
+                r"'A.cs' \(copies a.id to b.a_id\), "
+                r"'C.as' \(copies a.id to b.a_id\)"
+                r".*add the parameter 'overlaps=\"as,cs\"' to the 'B.a' "
                 r"relationship",
                 #
                 #
                 r"relationship 'B.c' will copy column c.id to column b.c_id, "
                 r"which conflicts with relationship\(s\): "
-                r"'C.as' \(copies c.id to b.c_id\), "
-                r"'A.cs' \(copies c.id to b.c_id\)"
+                r"'A.cs' \(copies c.id to b.c_id\), "
+                r"'C.as' \(copies c.id to b.c_id\)"
                 r".*add the parameter 'overlaps=\"as,cs\"' to the 'B.c' "
                 r"relationship",
                 #
                 #
                 r"relationship 'C.bs' will copy column c.id to column b.c_id, "
                 r"which conflicts with relationship\(s\): "
-                r"'C.as' \(copies c.id to b.c_id\), "
-                r"'A.cs' \(copies c.id to b.c_id\)"
+                r"'A.cs' \(copies c.id to b.c_id\), "
+                r"'C.as' \(copies c.id to b.c_id\)"
                 r".*add the parameter 'overlaps=\"as,cs\"' to the 'C.bs' "
                 r"relationship",
             ):