]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Add tests for empty association set comparison
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 13 Mar 2017 15:48:42 +0000 (11:48 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 13 Mar 2017 18:44:50 +0000 (14:44 -0400)
This seems to only occur in python 2.6, adding tests
to ensure it stays

Change-Id: Id714680970bf1f70e2fe06b0c8688b7c5a6b6b0c
Fixes: #3265
test/ext/test_associationproxy.py

index 0f86a9a14ebdb5987f2c0c867a8a6da37c47b245..018c2bc2ad789ef198b822267f5e9a4ed670a5f5 100644 (file)
@@ -1,4 +1,4 @@
-from sqlalchemy.testing import eq_, assert_raises
+from sqlalchemy.testing import eq_, assert_raises, is_
 import copy
 import pickle
 
@@ -502,6 +502,30 @@ class SetTest(_CollectionOperations):
             self.assert_((p1.children > other) == (control > other))
             self.assert_((p1.children >= other) == (control >= other))
 
+    def test_set_comparison_empty_to_empty(self):
+        # test issue #3265 which appears to be python 2.6 specific
+        Parent = self.Parent
+
+        p1 = Parent('P1')
+        p1.children = []
+
+        p2 = Parent('P2')
+        p2.children = []
+
+        set_0 = set()
+        set_a = p1.children
+        set_b = p2.children
+
+        is_(set_a == set_a, True)
+        is_(set_a == set_b, True)
+        is_(set_a == set_0, True)
+        is_(set_0 == set_a, True)
+
+        is_(set_a != set_a, False)
+        is_(set_a != set_b, False)
+        is_(set_a != set_0, False)
+        is_(set_0 != set_a, False)
+
     def test_set_mutation(self):
         Parent, Child = self.Parent, self.Child