@@ -109,14 +109,11 @@ def test_none_to_nan(cls, dtype):
109109def test_setitem_validates (cls , dtype ):
110110 arr = cls ._from_sequence (["a" , "b" ], dtype = dtype )
111111
112- if dtype .storage == "python" :
113- msg = "Cannot set non-string value '10' into a StringArray."
114- else :
115- msg = "Scalar must be NA or str"
112+ msg = "Invalid value '10' for dtype 'str"
116113 with pytest .raises (TypeError , match = msg ):
117114 arr [0 ] = 10
118115
119- msg = "Must provide strings "
116+ msg = "Invalid value for dtype 'str "
120117 with pytest .raises (TypeError , match = msg ):
121118 arr [:] = np .array ([1 , 2 ])
122119
@@ -508,10 +505,7 @@ def test_fillna_args(dtype):
508505 expected = pd .array (["a" , "b" ], dtype = dtype )
509506 tm .assert_extension_array_equal (res , expected )
510507
511- if dtype .storage == "pyarrow" :
512- msg = "Invalid value '1' for dtype str"
513- else :
514- msg = "Cannot set non-string value '1' into a StringArray."
508+ msg = "Invalid value '1' for dtype 'str"
515509 with pytest .raises (TypeError , match = msg ):
516510 arr .fillna (value = 1 )
517511
@@ -727,10 +721,7 @@ def test_setitem_scalar_with_mask_validation(dtype):
727721
728722 # for other non-string we should also raise an error
729723 ser = pd .Series (["a" , "b" , "c" ], dtype = dtype )
730- if dtype .storage == "python" :
731- msg = "Cannot set non-string value"
732- else :
733- msg = "Scalar must be NA or str"
724+ msg = "Invalid value '1' for dtype 'str"
734725 with pytest .raises (TypeError , match = msg ):
735726 ser [mask ] = 1
736727
0 commit comments