Skip to content

Commit 5014559

Browse files
committed
Tests for idx.array and idx.values immutability
1 parent 48146ad commit 5014559

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

pandas/tests/indexes/test_any_index.py

+16-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,22 @@ def test_mutability(index):
3333
index[0] = index[0]
3434

3535

36-
def test_wrong_number_names(index):
37-
names = index.nlevels * ["apple", "banana", "carrot"]
36+
def test_values_mutability(indices):
37+
if not len(indices):
38+
return
39+
with pytest.raises(ValueError):
40+
indices.values[0] = indices[0]
41+
42+
43+
def test_array_mutability(indices):
44+
if not len(indices):
45+
return
46+
with pytest.raises(ValueError):
47+
indices.array[0] = indices[0]
48+
49+
50+
def test_wrong_number_names(indices):
51+
names = indices.nlevels * ["apple", "banana", "carrot"]
3852
with pytest.raises(ValueError, match="^Length"):
3953
index.names = names
4054

0 commit comments

Comments
 (0)