Skip to content
Merged
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