Add set.union and set.intersection aliases to set.__ior__ and set.__i… #684
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,6 +62,34 @@ def test_iter(self): | |
""") | ||
|
||
|
||
def test__ior__(self): | ||
self.assertCodeExecution(""" | ||
a = {'a', 'b', 'c'} | ||
b = {'a', 'c', 'd'} | ||
a.__ior__(b) | ||
""") | ||
|
||
def test__iand__(self): | ||
self.assertCodeExecution(""" | ||
a = {'a', 'b', 'c'} | ||
b = {'a', 'c', 'd'} | ||
a.__iand__(b) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The check of |
||
""") | ||
|
||
|
||
def test_union(self): | ||
self.assertCodeExecution(""" | ||
a = {'a', 'b', 'c'} | ||
b = {'a', 'c', 'd'} | ||
a.union(b) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Although this is executes the right code, it won't actually test anything. To test that the output is correct, you have to print the result of the operation so that there is something to compare. |
||
""") | ||
|
||
def test_intersection(self): | ||
self.assertCodeExecution(""" | ||
a = {'a', 'b', 'c'} | ||
b = {'a', 'c', 'd'} | ||
a.intersection(b) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As with |
||
""") | ||
|
||
class UnarySetOperationTests(UnaryOperationTestCase, TranspileTestCase): | ||
data_type = 'set' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The check of
__ior__
isn't needed - it's covered automatically by the InlineBinaryOperationTests.