Skip to content

Commit 84d7c1f

Browse files
committed
add test for when str array raises type error
1 parent 84bf1ef commit 84d7c1f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pandas/tests/indexes/test_base.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,6 +1351,10 @@ def test_index_round(self, decimals, expected_results):
13511351

13521352
tm.assert_index_equal(result, expected)
13531353

1354+
def test_string_array_view_type_error(self):
1355+
arr = pd.array(["a", "b", "c"], dtype="string")
1356+
with pytest.raises(TypeError, match="Cannot change data-type for string array."):
1357+
arr.view("i8")
13541358

13551359
class TestMixedIntIndex:
13561360
# Mostly the tests from common.py for which the results differ

0 commit comments

Comments
 (0)