Commit 05c70fdf authored by Damien George's avatar Damien George
Browse files

tests/basics/set_binop: Add tests for inplace set operations.

parent 30cf503e
......@@ -29,6 +29,25 @@ for s in sets:
print(set('abc') == 1)
# make sure inplace operators modify the set
s1 = s2 = set('abc')
s1 |= set('ad')
print(s1 is s2, len(s1))
s1 = s2 = set('abc')
s1 ^= set('ad')
print(s1 is s2, len(s1))
s1 = s2 = set('abc')
s1 &= set('ad')
print(s1 is s2, len(s1))
s1 = s2 = set('abc')
s1 -= set('ad')
print(s1 is s2, len(s1))
# unsupported operator
try:
set('abc') * 2
except TypeError:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment