8000 Make pd.Period immutable by jbrockmendel · Pull Request #17239 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

Make pd.Period immutable #17239

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Aug 24, 2017
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Tests for Period immutability
  • Loading branch information
jbrockmendel committed Aug 12, 2017
commit e6ca02cb2c036da35a61fc5a6bfc24a62d789366
11 changes: 11 additions & 0 deletions pandas/tests/test_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,3 +248,14 @@ def test_empty_like(self):
expected = np.array([True])

self._check_behavior(arr, expected)



def test_period_immutable():
per = pd.Period('2014Q1')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add the issue number here. move test to tests for period scalars.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.

with pytest.raises(AttributeError, message="is not writable"):
per.ordinal = 14

freq = per.freq
with pytest.raises(AttributeError, message="is not writable"):
per.freq = 2*freq
0