From: Mike Bayer Date: Mon, 13 Mar 2017 15:48:42 +0000 (-0400) Subject: Add tests for empty association set comparison X-Git-Tag: rel_1_2_0b1~161 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0612829fb04565c00f8993b978697a8701204977;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Add tests for empty association set comparison This seems to only occur in python 2.6, adding tests to ensure it stays Change-Id: Id714680970bf1f70e2fe06b0c8688b7c5a6b6b0c Fixes: #3265 --- diff --git a/test/ext/test_associationproxy.py b/test/ext/test_associationproxy.py index 0f86a9a14e..018c2bc2ad 100644 --- a/test/ext/test_associationproxy.py +++ b/test/ext/test_associationproxy.py @@ -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