Skip to content

Commit 922c7b0

Browse files
committed
Test "copy" argument
1 parent af99190 commit 922c7b0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pandas/tests/sparse/test_indexing.py

+7
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,7 @@ def test_loc_slice(self):
543543
tm.assert_sp_series_equal(sparse.loc[:'B'], orig.loc[:'B'].to_sparse())
544544

545545
def test_reindex(self):
546+
# GH 15447
546547
orig = self.orig
547548
sparse = self.sparse
548549

@@ -564,6 +565,12 @@ def test_reindex(self):
564565
# Incomplete keys are not accepted for reindexing:
565566
sparse.reindex(['A', 'C'])
566567

568+
# "copy" argument:
569+
res = sparse.reindex(sparse.index, copy=True)
570+
exp = orig.reindex(orig.index, copy=True).to_sparse()
571+
tm.assert_sp_series_equal(res, exp)
572+
self.assertIsNot(sparse, res)
573+
567574

568575
class TestSparseDataFrameIndexing(tm.TestCase):
569576

0 commit comments

Comments
 (0)