Skip to content

Commit f832a44

Browse files
committed
added tests for copy and deepcopy
1 parent 6661e32 commit f832a44

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

pandas/tests/test_generic.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# pylint: disable-msg=E1101,W0612
33

44
from operator import methodcaller
5-
from copy import deepcopy
5+
from copy import copy, deepcopy
66
import pytest
77
import numpy as np
88
from numpy import nan
@@ -676,6 +676,16 @@ def test_validate_bool_args(self):
676676
with self.assertRaises(ValueError):
677677
super(DataFrame, df).mask(cond=df.a > 2, inplace=value)
678678

679+
def test_copy_and_deepcopy(self):
680+
681+
for shape in [0, 1, 2]:
682+
obj = self._construct(shape)
683+
684+
for func in (copy, deepcopy):
685+
obj_copy = func(obj)
686+
self.assertIsNot(obj_copy, obj)
687+
self._compare(obj_copy, obj)
688+
679689

680690
class TestSeries(tm.TestCase, Generic):
681691
_typ = Series
@@ -1542,8 +1552,7 @@ def test_to_xarray(self):
15421552

15431553
def test_deepcopy_empty(self):
15441554
# This test covers empty frame copying with non-empty column sets
1545-
# as reported in issue #15370
1546-
# https://github.com/pandas-dev/pandas/issues/15370
1555+
# as reported in issue GH15370
15471556
empty_frame = DataFrame(data=[], index=[], columns=['A'])
15481557
empty_frame_copy = deepcopy(empty_frame)
15491558

0 commit comments

Comments
 (0)