diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-12-06 13:22:59 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-12-06 13:22:59 -0500 |
commit | a8dc787ff02490da17e8704ca564bf0c6b46c04d (patch) | |
tree | 0dcecf3d0622813824398c29b3bf44518adb131a /test/base/test_utils.py | |
parent | b53349a40389b65066fdcdd9572dd8ee052da8ff (diff) | |
download | sqlalchemy-a8dc787ff02490da17e8704ca564bf0c6b46c04d.tar.gz |
- [feature] IdentitySet supports the - operator
as the same as difference(), handy when dealing
with Session.dirty etc. [ticket:2301]
Diffstat (limited to 'test/base/test_utils.py')
-rw-r--r-- | test/base/test_utils.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/base/test_utils.py b/test/base/test_utils.py index 61c7ad9d6..3a7ce07f2 100644 --- a/test/base/test_utils.py +++ b/test/base/test_utils.py @@ -290,6 +290,19 @@ class IdentitySetTest(fixtures.TestBase): ids.add(data[i]) self.assert_eq(ids, data) + def test_dunder_sub(self): + IdentitySet = util.IdentitySet + o1, o2, o3 = object(), object(), object() + ids1 = IdentitySet([o1]) + ids2 = IdentitySet([o1, o2, o3]) + eq_( + ids2 - ids1, + IdentitySet([o2, o3]) + ) + + ids2 -= ids1 + eq_(ids2, IdentitySet([o2, o3])) + def test_basic_sanity(self): IdentitySet = util.IdentitySet |