Skip to content

Commit b386ef4

Browse files
committed
-
1 parent 847a1e4 commit b386ef4

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

source_py3/test_python_toolbox/test_nifty_collections/test_bagging.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import collections
99
import decimal as decimal_module
1010
from python_toolbox.third_party import unittest2
11+
import copy
1112

1213
import 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

189200
class BaseMutableBagTestCase(BaseBagTestCase):

0 commit comments

Comments
 (0)