Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions quantities/quantity.py
Original file line number Diff line number Diff line change
Expand Up @@ -804,10 +804,6 @@ def __reduce__(self):
(self.__class__, np.ndarray, (0, ), 'b', ),
state)

def __deepcopy__(self, memo_dict):
# constructor copies by default
return Quantity(self.magnitude, self.dimensionality)


def _reconstruct_quantity(subtype, baseclass, baseshape, basetype,):
"""Internal function that builds a new MaskedArray from the
Expand Down
9 changes: 9 additions & 0 deletions quantities/tests/test_persistence.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,15 @@ def test_copy_quantity(self):
y = copy.copy(x)
self.assertQuantityEqual(x, y)

def test_deepcopy_quantity(self):
x = [1, 2, 3] * pq.m
y = copy.deepcopy(x)
self.assertQuantityEqual(x, y)

y[0] = 100 * pq.m
self.assertQuantityEqual(x, [1, 2, 3] * pq.m)


def test_copy_uncertainquantity(self):
for dtype in [float, object]:
x = UncertainQuantity(20, 'm', 0.2).astype(dtype)
Expand Down