Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 3 additions & 2 deletions pandas/tests/arrays/categorical/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def test_set_ordered(self):
assert not cat2.ordered

# removed in 0.19.0
msg = "can't set attribute"
msg = "can't set attribute|property .* of .* object has no setter"
with pytest.raises(AttributeError, match=msg):
cat.ordered = True
with pytest.raises(AttributeError, match=msg):
Expand Down Expand Up @@ -507,7 +507,8 @@ def test_codes_immutable(self):
tm.assert_numpy_array_equal(c.codes, exp)

# Assignments to codes should raise
with pytest.raises(AttributeError, match="can't set attribute"):
msg = "can't set attribute|property .* of .* object has no setter"
with pytest.raises(AttributeError, match=msg):
c.codes = np.array([0, 1, 2, 0, 1], dtype="int8")

# changes in the codes array should raise
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/indexes/multi/test_get_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def test_set_levels_codes_directly(idx):
minor_codes = [(x + 1) % 1 for x in minor_codes]
new_codes = [major_codes, minor_codes]

msg = "[Cc]an't set attribute"
msg = "[Cc]an't set attribute|property .* of .* object has no setter"
with pytest.raises(AttributeError, match=msg):
idx.levels = new_levels
with pytest.raises(AttributeError, match=msg):
Expand Down
3 changes: 2 additions & 1 deletion pandas/tests/indexes/period/test_freq_attr.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ def test_freq_setter_deprecated(self):
idx.freq

# warning for setter
with pytest.raises(AttributeError, match="can't set attribute"):
msg = "can't set attribute|property .* of .* object has no setter"
with pytest.raises(AttributeError, match=msg):
idx.freq = offsets.Day()