|
2 | 2 | # pylint: disable-msg=E1101,W0612
|
3 | 3 |
|
4 | 4 | from operator import methodcaller
|
5 |
| -from copy import deepcopy |
| 5 | +from copy import copy, deepcopy |
6 | 6 | import pytest
|
7 | 7 | import numpy as np
|
8 | 8 | from numpy import nan
|
@@ -676,6 +676,16 @@ def test_validate_bool_args(self):
|
676 | 676 | with self.assertRaises(ValueError):
|
677 | 677 | super(DataFrame, df).mask(cond=df.a > 2, inplace=value)
|
678 | 678 |
|
| 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 | + |
679 | 689 |
|
680 | 690 | class TestSeries(tm.TestCase, Generic):
|
681 | 691 | _typ = Series
|
@@ -1542,8 +1552,7 @@ def test_to_xarray(self):
|
1542 | 1552 |
|
1543 | 1553 | def test_deepcopy_empty(self):
|
1544 | 1554 | # 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 |
1547 | 1556 | empty_frame = DataFrame(data=[], index=[], columns=['A'])
|
1548 | 1557 | empty_frame_copy = deepcopy(empty_frame)
|
1549 | 1558 |
|
|
0 commit comments