File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
source_py3/test_python_toolbox/test_nifty_collections Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 88import collections
99import decimal as decimal_module
1010from python_toolbox .third_party import unittest2
11+ import copy
1112
1213import nose
1314
@@ -183,7 +184,17 @@ def test_ignores_zero(self):
183184 assert hash (bag_2 ) == hash (bag_3 )
184185 assert {bag_2 , bag_3 } == {bag_2 } == {bag_3 }
185186
186-
187+ def test_copy (self ):
188+ my_tuple = ('meow' ,)
189+ bag = self .bag_type ({my_tuple : 3 , 'a' : 4 ,})
190+ bag_shallow_copy = copy .copy (bag )
191+ bag_deep_copy = copy .deepcopy (bag )
192+ assert bag_shallow_copy == bag == bag_deep_copy
193+ assert next (iter (bag_shallow_copy )) == next (iter (bag_shallow_copy )) \
194+ != next (iter (bag_shallow_copy ))
195+ assert next (iter (bag_shallow_copy )) is next (iter (bag_shallow_copy )) \
196+ is not next (iter (bag_shallow_copy ))
197+
187198
188199
189200class BaseMutableBagTestCase (BaseBagTestCase ):
You can’t perform that action at this time.
0 commit comments