new_values = list(new_collection.adapt_like_to_iterable(value))
old = self.get(state)
+
+ # ignore re-assignment of the current collection, as happens
+ # implicitly with in-place operators (foo.collection |= other)
+ if old is value:
+ return
+
state.committed_state[self.key] = self.copy(old)
-
+
old_collection = self.get_collection(state, old)
idset = util.IdentitySet
control |= values
assert_eq()
+ # cover self-assignment short-circuit
+ values = set([e, creator(), creator()])
+ obj.attr |= values
+ control |= values
+ assert_eq()
+
try:
direct |= [e, creator()]
assert False
control -= values
assert_eq()
+ values = set([creator()])
+ obj.attr -= values
+ control -= values
+ assert_eq()
+
try:
direct -= [e, creator()]
assert False
control &= values
assert_eq()
+ values.update(set([creator()]))
+ obj.attr &= values
+ control &= values
+ assert_eq()
+
try:
direct &= [e, creator()]
assert False
control ^= values
assert_eq()
+ values = set([creator()])
+ obj.attr ^= values
+ control ^= values
+ assert_eq()
+
try:
direct ^= [e, creator()]
assert False