Skip to content

Commit

Permalink
add tests for direct slicing
Browse files Browse the repository at this point in the history
  • Loading branch information
margaret committed Jun 14, 2017
1 parent 3f33c61 commit d130824
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pandas/tests/indexing/test_loc.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,7 @@ def test_identity_slice_returns_new_object(self):
original_df = DataFrame({'a': [1, 2, 3]})
sliced_df = original_df.loc[:]
assert sliced_df is not original_df
assert original_df[:] is not original_df

# should be a shallow copy
original_df['a'] = [4, 4, 4]
Expand All @@ -650,6 +651,7 @@ def test_identity_slice_returns_new_object(self):
original_series = Series([1, 2, 3, 4, 5, 6])
sliced_series = original_series.loc[:]
assert sliced_series is not original_series
assert original_series[:] is not original_series

original_series[:3] = [7, 8, 9]
assert all(sliced_series[:3] == [7, 8, 9])

0 comments on commit d130824

Please sign in to comment.