@@ -250,7 +250,7 @@ def test_sort(self):
250250 with cute_testing .RaiseAssertor (AttributeError ):
251251 bag .sort ()
252252
253- def test_unsupported_operations (self ):
253+ def test_operations_with_foreign_operands (self ):
254254 bag = self .bag_type ('meeeeow' )
255255 with cute_testing .RaiseAssertor (TypeError ): bag | 'foo'
256256 with cute_testing .RaiseAssertor (TypeError ): 'foo' | bag
@@ -283,6 +283,25 @@ def test_unsupported_operations(self):
283283 with cute_testing .RaiseAssertor (TypeError ): bag %= 'foo'
284284 with cute_testing .RaiseAssertor (TypeError ): bag **= 'foo'
285285
286+ def test_operations (self ):
287+ bag_0 = self .bag_type ('abbccc' )
288+ bag_1 = self .bag_type ('bcc' )
289+ bag_2 = self .bag_type ('cddddd' )
290+ assert bag_0 + bag_1 == self .bag_type ('abbccc' + 'bcc' )
291+ assert bag_1 + bag_0 == self .bag_type ('bcc' + 'abbccc' )
292+ assert bag_0 + bag_2 == self .bag_type ('abbccc' + 'cddddd' )
293+ assert bag_2 + bag_0 == self .bag_type ('cddddd' + 'abbccc' )
294+ assert bag_1 + bag_2 == self .bag_type ('bcc' + 'cddddd' )
295+ assert bag_2 + bag_1 == self .bag_type ('cddddd' + 'bcc' )
296+
297+ assert bag_0 - bag_1 == self .bag_type ('abc' )
298+ assert bag_1 - bag_0 == self .bag_type ()
299+ assert bag_0 - bag_2 == self .bag_type ('abbcc' )
300+ assert bag_2 - bag_0 == self .bag_type ('ddddd' )
301+ assert bag_1 - bag_2 == self .bag_type ('bc' )
302+ assert bag_2 - bag_1 == self .bag_type ('ddddd' )
303+
304+ # blocktodo: continue for all operations
286305
287306
288307
0 commit comments